 |
|
 |
|
Next: Copy diagram from one DB to another?
|
| Author |
Message |
External

Since: Jan 14, 2008 Posts: 76
|
(Msg. 1) Posted: Wed Nov 29, 2006 3:46 am
Post subject: Order by [alias] in 2005 issue Archived from groups: microsoft>public>sqlserver>programming (more info?)
|
|
|
So this 'order by' works in SQL2000, but will error in 2005 -
select top 1 a.forderID [orderId] from MyTable a
order by a.orderid
SQL2005 eRR:
Msg 207, Level 16, State 1, Line 2
Invalid column name 'orderid'.
How to work around? Is there a server setting that will act like SQL2000? We
have literally thousands of sprocs, and in-line sql all over... gonna be a
challenge.
Any help much appreciated.
Thanks,
Chris >> Stay informed about: Order by [alias] in 2005 issue |
|
| Back to top |
|
 |  |
External

Since: Nov 21, 2006 Posts: 285
|
(Msg. 2) Posted: Fri Dec 01, 2006 7:55 am
Post subject: Re: Order by [alias] in 2005 issue [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Chris wrote:
> So this 'order by' works in SQL2000, but will error in 2005 -
>
> select top 1 a.forderID [orderId] from MyTable a
> order by a.orderid
>
> SQL2005 eRR:
> Msg 207, Level 16, State 1, Line 2
> Invalid column name 'orderid'.
>
> How to work around? Is there a server setting that will act like SQL2000? We
> have literally thousands of sprocs, and in-line sql all over... gonna be a
> challenge.
>
> Any help much appreciated.
>
> Thanks,
> Chris
This is documented behavior, and the SQL 2005 Upgrade Advisor would have
warned you had you run it.
http://msdn2.microsoft.com/en-us/library/ms143359.aspx
--
Tracy McKibben
MCDBA
http://www.realsqlguy.com >> Stay informed about: Order by [alias] in 2005 issue |
|
| Back to top |
|
 |  |
| Related Topics: | When can we use column alias in where, group by, having, o.. - I have long been confused about this question. Look, the query below works. select vendorname, count(*) as invqty, avg(invoicetotal) as invavg from vendors join invoices on vendors.vendorid=invoices.vendorid group by vendorname having avg(invoicetotal)...
"order by" in SQL 2005 vs. SQL 2000 or other issue? - I am trying to find any issue why the data is not coming out as it is intended. I converted table and stored procedure from SQL 2000 to SQL 2005. However, on several reports, data is not listed as it is intended by "order by" clause. I guess o...
Order by Clause issue - Hi, We are upgrading our databse from SQL SERVER 2000 to SQL SERVER 2005. in this case while running the below query I am getting '' A column has been specified more than once in the order by list. Columns in the order by list must be unique" e...
Sort order in SQL 2005 - In a 2005 database table function that has SELECT TOP 100 Percent .... ORDER BY TextField This displays it in the primary key (numeric field) order and not the specified. Is there a setting change that is required to make the function return the order as...
Sort order in SQL 2005? - Hi, When sorting a numeric field in SQL 2005, I am finding that it is sorting it differently than it was in 2000. i.e. 1, 10, 1000, 1001, 1002, 2, 20, 2000, 2002. Is there a reason for this? Appreciate the help. Damon |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|