August 4, 2008 at 2:12 pm
Hi All,
Im running a query in 2005,I am getting some error like
Msg 104, Level 16, State 1, Line 1
ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or EXCEPT operator.
This query ran fine in 2000.
Why is it like that??Any clue?
August 4, 2008 at 2:18 pm
Can you post the query that is causing the problem?
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
August 4, 2008 at 2:40 pm
BTW, according to BOL this has changed:
Starting with Microsoft SQL Server 2005, SQL Server allows specifying ordering columns from tables in the FROM clause that are not specified in the SELECT list. The column names referenced in the ORDER BY clause must correspond to either a column in the SELECT list or a column of the table in the FROM clause without any ambiguities. If column names are aliased in the SELECT list, only the alias name can be used in the ORDER BY clause. Similarly, if table names are aliased in the FROM clause, only the alias names can be used to qualify their columns in the ORDER BY clause.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply