 |
|
 |
|
Next: Erro MSG 241 when I use smalldate time to define ..
|
| Author |
Message |
External

Since: Feb 07, 2008 Posts: 39
|
(Msg. 1) Posted: Wed Aug 06, 2008 11:41 am
Post subject: "order by" in SQL 2005 vs. SQL 2000 or other issue? Archived from groups: microsoft>public>sqlserver>programming (more info?)
|
|
|
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 one cause might be "Ambiguous column" (which replaced by putting
alise in front of column name).
Is there any other common factor why data is not coming out in the order as
I intended to be?
Thanks in advance >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2008 Posts: 91
|
(Msg. 2) Posted: Wed Aug 06, 2008 12:00 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 2:41 pm, Justin Doh
wrote:
> 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 one cause might be "Ambiguous column" (which replaced by putting
> alise in front of column name).
>
> Is there any other common factor why data is not coming out in the order as
> I intended to be?
>
> Thanks in advance
Can you give an example of a query that is not returning data as you'd
expect? >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
External

Since: Feb 07, 2008 Posts: 39
|
(Msg. 3) Posted: Wed Aug 06, 2008 12:25 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Sure. Thanks!
I am using temporary table as you see.
The problem is Manager is not ordered by LastName, FirstName.
Also the Total is shown up at first line rather than last line of the report.
--- 1) Manager List
SELECT am.sAMFirstName + ' ' + am.sAMLastName as 'sManager',
...INTO #Result1
FROM tableA AS f
LEFT JOIN tableB AS am
ON f.nEmployeeID = am.nManagerID
...GROUP BY f.nEmployeeID, am.sAMFirstName, am.sAMLastName, f.nReportCode
ORDER BY sManager, f.nReportCode
SELECT ..
INTO #Result2
FROM #Result1
GROUP BY sManager, nManagerID WITH CUBE
-- 2) Total
SELECT *
FROM #Result2
WHERE (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
NULL) --these rows are totals for each manager/ managerid by report desc
"Stuart Ainsworth" wrote:
> On Aug 6, 2:41 pm, Justin Doh
> wrote:
> > 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 one cause might be "Ambiguous column" (which replaced by putting
> > alise in front of column name).
> >
> > Is there any other common factor why data is not coming out in the order as
> > I intended to be?
> >
> > Thanks in advance
>
> Can you give an example of a query that is not returning data as you'd
> expect?
> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 1089
|
(Msg. 4) Posted: Wed Aug 06, 2008 2:12 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
You are still writing BASIC (look at the data type prefixes!) and
thinking in sequential files (ORDER BY on a temp table you used to
fake a 1950's style scratch tape). An SQL programmer would have used
a derived table or CTE so the optimizer could work on the query.
Tables have no ordering; this concept is fundamental. You can use an
ORDER BY on an explicit or implicit cursor for display purposes.
>> Also the Total is shown up at first line rather than last line of the report. <<
Read the part in the manual about how to use the GROUPING() function
in the OLAP extensions to GROUP BY. >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
|
Aaron Bertrand [SQL Serve
|
External

Since: Jan 10, 2008 Posts: 2166
|
(Msg. 5) Posted: Wed Aug 06, 2008 2:45 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Do you have ORDER BY in the query, or do you have ORDER BY in a view and you
are querying it without an outer ORDER BY? Without specific examples it's
going to be really hard to make any assessment and even harder to give you
any advice.
On 8/6/08 2:41 PM, in article
DC05029D-8937-49D9-813C-D16519F4989B.RemoveThis@microsoft.com, "Justin Doh"
wrote:
> 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 one cause might be "Ambiguous column" (which replaced by putting
> alise in front of column name).
>
> Is there any other common factor why data is not coming out in the order as
> I intended to be?
>
> Thanks in advance
>
> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
|
Aaron Bertrand [SQL Serve
|
External

Since: Jan 10, 2008 Posts: 2166
|
(Msg. 6) Posted: Wed Aug 06, 2008 3:57 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
SELECT INTO with an ORDER BY doesn't really mean anything. A table is by
definition an unordered set of rows, so even with an ORDER BY, SQL Server is
free to insert those rows in any physical order it feels is best, and
likewise when you SELECT without ORDER BY, it can also return those rows to
you in any order it feels is best. Just because you observed a certain
behavior in SQL Server 2000 does not make the behavior documented or
guaranteed. You need to add an order by on your last SELECT * ...
On 8/6/08 3:25 PM, in article
A890C1F8-82B4-418B-82FD-F1FE88192260 DeleteThis @microsoft.com, "Justin Doh"
wrote:
> Sure. Thanks!
>
> I am using temporary table as you see.
> The problem is Manager is not ordered by LastName, FirstName.
> Also the Total is shown up at first line rather than last line of the report.
>
> --- 1) Manager List
> SELECT am.sAMFirstName + ' ' + am.sAMLastName as 'sManager',
> ..INTO #Result1
>
> FROM tableA AS f
> LEFT JOIN tableB AS am
> ON f.nEmployeeID = am.nManagerID
> ..GROUP BY f.nEmployeeID, am.sAMFirstName, am.sAMLastName, f.nReportCode
>
> ORDER BY sManager, f.nReportCode
>
> SELECT ..
> INTO #Result2
> FROM #Result1
> GROUP BY sManager, nManagerID WITH CUBE
>
> -- 2) Total
> SELECT *
> FROM #Result2
> WHERE (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
> NULL) --these rows are totals for each manager/ managerid by report desc
>
>
>
>
>
> "Stuart Ainsworth" wrote:
>
>> On Aug 6, 2:41 pm, Justin Doh
>> wrote:
>>> 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 one cause might be "Ambiguous column" (which replaced by putting
>>> alise in front of column name).
>>>
>>> Is there any other common factor why data is not coming out in the order as
>>> I intended to be?
>>>
>>> Thanks in advance
>>
>> Can you give an example of a query that is not returning data as you'd
>> expect?
>> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
External

Since: Feb 07, 2008 Posts: 39
|
(Msg. 7) Posted: Wed Aug 06, 2008 3:57 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi Aaron,
I am little bit confused because I am not sure which one you are referring to.
It seems as you are referring to the last query.
I am concerned about the 1st query ( 1. Manager List) rather than the last
query.
There is "Order by" clause, isn't it?
Thanks.
"Aaron Bertrand [SQL Server MVP]" wrote:
> SELECT INTO with an ORDER BY doesn't really mean anything. A table is by
> definition an unordered set of rows, so even with an ORDER BY, SQL Server is
> free to insert those rows in any physical order it feels is best, and
> likewise when you SELECT without ORDER BY, it can also return those rows to
> you in any order it feels is best. Just because you observed a certain
> behavior in SQL Server 2000 does not make the behavior documented or
> guaranteed. You need to add an order by on your last SELECT * ...
>
>
> On 8/6/08 3:25 PM, in article
> A890C1F8-82B4-418B-82FD-F1FE88192260.TakeThisOut@microsoft.com, "Justin Doh"
> wrote:
>
> > Sure. Thanks!
> >
> > I am using temporary table as you see.
> > The problem is Manager is not ordered by LastName, FirstName.
> > Also the Total is shown up at first line rather than last line of the report.
> >
> > --- 1) Manager List
> > SELECT am.sAMFirstName + ' ' + am.sAMLastName as 'sManager',
> > ..INTO #Result1
> >
> > FROM tableA AS f
> > LEFT JOIN tableB AS am
> > ON f.nEmployeeID = am.nManagerID
> > ..GROUP BY f.nEmployeeID, am.sAMFirstName, am.sAMLastName, f.nReportCode
> >
> > ORDER BY sManager, f.nReportCode
> >
> > SELECT ..
> > INTO #Result2
> > FROM #Result1
> > GROUP BY sManager, nManagerID WITH CUBE
> >
> > -- 2) Total
> > SELECT *
> > FROM #Result2
> > WHERE (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
> > NULL) --these rows are totals for each manager/ managerid by report desc
> >
> >
> >
> >
> >
> > "Stuart Ainsworth" wrote:
> >
> >> On Aug 6, 2:41 pm, Justin Doh
> >> wrote:
> >>> 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 one cause might be "Ambiguous column" (which replaced by putting
> >>> alise in front of column name).
> >>>
> >>> Is there any other common factor why data is not coming out in the order as
> >>> I intended to be?
> >>>
> >>> Thanks in advance
> >>
> >> Can you give an example of a query that is not returning data as you'd
> >> expect?
> >>
>
> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
|
Aaron Bertrand [SQL Serve
|
External

Since: Jan 10, 2008 Posts: 2166
|
(Msg. 8) Posted: Wed Aug 06, 2008 5:13 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> I am little bit confused because I am not sure which one you are referring to.
> It seems as you are referring to the last query.
>
> I am concerned about the 1st query ( 1. Manager List) rather than the last
> query.
> There is "Order by" clause, isn't it?
Sure, there is an ORDER BY clause. But you are inserting rows into a NEW
table. A table is by definition an UNORDERED set of rows. So where do you
expect your order by clause to be respected, and how are you validating that
it wasn't? If you just say "SELECT * FROM newtable" SQL Server is free to
return those rows in any order it wants. This *might* be the same as the
order you thought you tried to insert, but it is not something you should
expect or rely on. If you want data returned out of the table in a specific
order, then specify an order by clause on the final select, not on an insert
or select into statement. >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
External

Since: Feb 07, 2008 Posts: 39
|
(Msg. 9) Posted: Wed Aug 06, 2008 5:13 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
You know what.
Your explanation is completely logical, and I did not pay close attention to
what you were trying to say at first.
I guess right now I am having difficulty correcting the last query in order
to get the data straight. Please refer to the bottom query as it is the
correct query.
SELECT *
FROM #Result2
WHERE
(nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
NULL)--these rows are totals for each manager/managerid by report desc
OR
(nManagerID IS NULL AND sManager IS NULL AND sManager IS NULL)--this row
contains report totals
-- ORDER BY sManager
If I add "ORDER BY sManager" at the end, it lists data aphabetically.
However, "report total" line is shown at the top rather the at the last
column.
How do I fix that?
Thanks in advance.
"Aaron Bertrand [SQL Server MVP]" wrote:
> > I am little bit confused because I am not sure which one you are referring to.
> > It seems as you are referring to the last query.
> >
> > I am concerned about the 1st query ( 1. Manager List) rather than the last
> > query.
> > There is "Order by" clause, isn't it?
>
> Sure, there is an ORDER BY clause. But you are inserting rows into a NEW
> table. A table is by definition an UNORDERED set of rows. So where do you
> expect your order by clause to be respected, and how are you validating that
> it wasn't? If you just say "SELECT * FROM newtable" SQL Server is free to
> return those rows in any order it wants. This *might* be the same as the
> order you thought you tried to insert, but it is not something you should
> expect or rely on. If you want data returned out of the table in a specific
> order, then specify an order by clause on the final select, not on an insert
> or select into statement.
>
> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
|
Aaron Bertrand [SQL Serve
|
External

Since: Jan 10, 2008 Posts: 2166
|
(Msg. 10) Posted: Wed Aug 06, 2008 6:27 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Can you show sample data and desired results? I can't write a query against
data I can't see.
On 8/6/08 6:05 PM, in article
DEAACFA8-33EC-42A9-ACD9-EAF516061F3E.DeleteThis@microsoft.com, "Justin Doh"
wrote:
> You know what.
> Your explanation is completely logical, and I did not pay close attention to
> what you were trying to say at first.
> I guess right now I am having difficulty correcting the last query in order
> to get the data straight. Please refer to the bottom query as it is the
> correct query.
>
> SELECT *
> FROM #Result2
> WHERE
> (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
> NULL)--these rows are totals for each manager/managerid by report desc
> OR
> (nManagerID IS NULL AND sManager IS NULL AND sManager IS NULL)--this row
> contains report totals
> -- ORDER BY sManager
>
> If I add "ORDER BY sManager" at the end, it lists data aphabetically.
> However, "report total" line is shown at the top rather the at the last
> column.
>
> How do I fix that?
> Thanks in advance.
>
>
>
>
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>
>>> I am little bit confused because I am not sure which one you are referring
>>> to.
>>> It seems as you are referring to the last query.
>>>
>>> I am concerned about the 1st query ( 1. Manager List) rather than the last
>>> query.
>>> There is "Order by" clause, isn't it?
>>
>> Sure, there is an ORDER BY clause. But you are inserting rows into a NEW
>> table. A table is by definition an UNORDERED set of rows. So where do you
>> expect your order by clause to be respected, and how are you validating that
>> it wasn't? If you just say "SELECT * FROM newtable" SQL Server is free to
>> return those rows in any order it wants. This *might* be the same as the
>> order you thought you tried to insert, but it is not something you should
>> expect or rely on. If you want data returned out of the table in a specific
>> order, then specify an order by clause on the final select, not on an insert
>> or select into statement.
>>
>> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
External

Since: Feb 07, 2008 Posts: 39
|
(Msg. 11) Posted: Wed Aug 06, 2008 6:27 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Basically,
My result is like:
Manager LA SF NY
--------------------------------------------
Grand Total 564 456 189
Aaron Page 2 5 0
Bill Boy 5 1 7
John Doh 1 11 23
Jane Smith 7 0 3
...
Wayne World 3 1 7
Rather it should be something like this:
Manager LA SF NY
--------------------------------------------
Aaron Page 2 5 0
Bill Boy 5 1 7
John Doh 1 11 23
Jane Smith 7 0 3
...
Wayne World 3 1 7
Grand Total 564 456 189
I think dealing with the temporary table is the one issue, but can we do
something at the last query to direct table to show data accordingly?
(Last query)
...
WHERE
(nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
NULL) --these rows are totals for each manager/managerid by report desc
OR
(nManagerID IS NULL AND sManager IS NULL AND sManager IS NULL) --this row
contains report totals
-- ORDER BY sManager
Thank you.
"Aaron Bertrand [SQL Server MVP]" wrote:
> Can you show sample data and desired results? I can't write a query against
> data I can't see.
>
>
> On 8/6/08 6:05 PM, in article
> DEAACFA8-33EC-42A9-ACD9-EAF516061F3E RemoveThis @microsoft.com, "Justin Doh"
> wrote:
>
> > You know what.
> > Your explanation is completely logical, and I did not pay close attention to
> > what you were trying to say at first.
> > I guess right now I am having difficulty correcting the last query in order
> > to get the data straight. Please refer to the bottom query as it is the
> > correct query.
> >
> > SELECT *
> > FROM #Result2
> > WHERE
> > (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
> > NULL)--these rows are totals for each manager/managerid by report desc
> > OR
> > (nManagerID IS NULL AND sManager IS NULL AND sManager IS NULL)--this row
> > contains report totals
> > -- ORDER BY sManager
> >
> > If I add "ORDER BY sManager" at the end, it lists data aphabetically.
> > However, "report total" line is shown at the top rather the at the last
> > column.
> >
> > How do I fix that?
> > Thanks in advance.
> >
> >
> >
> >
> >
> > "Aaron Bertrand [SQL Server MVP]" wrote:
> >
> >>> I am little bit confused because I am not sure which one you are referring
> >>> to.
> >>> It seems as you are referring to the last query.
> >>>
> >>> I am concerned about the 1st query ( 1. Manager List) rather than the last
> >>> query.
> >>> There is "Order by" clause, isn't it?
> >>
> >> Sure, there is an ORDER BY clause. But you are inserting rows into a NEW
> >> table. A table is by definition an UNORDERED set of rows. So where do you
> >> expect your order by clause to be respected, and how are you validating that
> >> it wasn't? If you just say "SELECT * FROM newtable" SQL Server is free to
> >> return those rows in any order it wants. This *might* be the same as the
> >> order you thought you tried to insert, but it is not something you should
> >> expect or rely on. If you want data returned out of the table in a specific
> >> order, then specify an order by clause on the final select, not on an insert
> >> or select into statement.
> >>
> >>
>
> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
|
Aaron Bertrand [SQL Serve
|
External

Since: Jan 10, 2008 Posts: 2166
|
(Msg. 12) Posted: Wed Aug 06, 2008 7:06 pm
Post subject: Re: "order by" in SQL 2005 vs. SQL 2000 or other issue? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
ORDER BY CASE WHEN nManagerID IS NULL AND sManager IS NULL
--AND sManager IS NULL --redundant, no?
THEN 1 ELSE 0 END, sManager
On 8/6/08 6:59 PM, in article
0924C99B-8C16-456F-9130-0487EBEAFB87 RemoveThis @microsoft.com, "Justin Doh"
wrote:
> Basically,
>
> My result is like:
> Manager LA SF NY
> --------------------------------------------
> Grand Total 564 456 189
> Aaron Page 2 5 0
> Bill Boy 5 1 7
> John Doh 1 11 23
> Jane Smith 7 0 3
> ..
>
> Wayne World 3 1 7
>
> Rather it should be something like this:
> Manager LA SF NY
> --------------------------------------------
> Aaron Page 2 5 0
> Bill Boy 5 1 7
> John Doh 1 11 23
> Jane Smith 7 0 3
> ..
>
> Wayne World 3 1 7
> Grand Total 564 456 189
>
> I think dealing with the temporary table is the one issue, but can we do
> something at the last query to direct table to show data accordingly?
>
> (Last query)
> ..
>
> WHERE
> (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
> NULL) --these rows are totals for each manager/managerid by report desc
> OR
> (nManagerID IS NULL AND sManager IS NULL AND sManager IS NULL) --this row
> contains report totals
> -- ORDER BY sManager
>
> Thank you.
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>
>> Can you show sample data and desired results? I can't write a query against
>> data I can't see.
>>
>>
>> On 8/6/08 6:05 PM, in article
>> DEAACFA8-33EC-42A9-ACD9-EAF516061F3E RemoveThis @microsoft.com, "Justin Doh"
>> wrote:
>>
>>> You know what.
>>> Your explanation is completely logical, and I did not pay close attention to
>>> what you were trying to say at first.
>>> I guess right now I am having difficulty correcting the last query in order
>>> to get the data straight. Please refer to the bottom query as it is the
>>> correct query.
>>>
>>> SELECT *
>>> FROM #Result2
>>> WHERE
>>> (nManagerID IS NOT NULL AND sManager IS NOT NULL AND sManager IS NOT
>>> NULL)--these rows are totals for each manager/managerid by report desc
>>> OR
>>> (nManagerID IS NULL AND sManager IS NULL AND sManager IS NULL)--this row
>>> contains report totals
>>> -- ORDER BY sManager
>>>
>>> If I add "ORDER BY sManager" at the end, it lists data aphabetically.
>>> However, "report total" line is shown at the top rather the at the last
>>> column.
>>>
>>> How do I fix that?
>>> Thanks in advance.
>>>
>>>
>>>
>>>
>>>
>>> "Aaron Bertrand [SQL Server MVP]" wrote:
>>>
>>>>> I am little bit confused because I am not sure which one you are referring
>>>>> to.
>>>>> It seems as you are referring to the last query.
>>>>>
>>>>> I am concerned about the 1st query ( 1. Manager List) rather than the last
>>>>> query.
>>>>> There is "Order by" clause, isn't it?
>>>>
>>>> Sure, there is an ORDER BY clause. But you are inserting rows into a NEW
>>>> table. A table is by definition an UNORDERED set of rows. So where do you
>>>> expect your order by clause to be respected, and how are you validating
>>>> that
>>>> it wasn't? If you just say "SELECT * FROM newtable" SQL Server is free to
>>>> return those rows in any order it wants. This *might* be the same as the
>>>> order you thought you tried to insert, but it is not something you should
>>>> expect or rely on. If you want data returned out of the table in a
>>>> specific
>>>> order, then specify an order by clause on the final select, not on an
>>>> insert
>>>> or select into statement.
>>>>
>>>>
>>
>> >> Stay informed about: ""order by"" in SQL 2005 vs. SQL 2000 or other issue? |
|
| Back to top |
|
 |  |
| Related Topics: | Order by [alias] in 2005 issue - 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...
Stored proc issue after converting from Sql Server 2000 to.. - Hello, I recently converted a Sql Server 2000 database to 2005 (using the copy database method). After conversion, all of the stored procedures executed just as they had before . . . no problems. I have run the following issue, however . . . ..
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...
SQL Server 2005 Reporting 2000 to 2005 - Hello I have some databases on sql 2000 Developer Ed SP4 version 8.00.2039 and it work with reporting services Developer Ed version 8.0.1038.00. I need upgrade it to sql2005 and reporting services 2005 too SP2. But I want to do upgrade without..
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... |
|
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
|
|
|
|
 |
|
|