Unix Technical Forum

ORDER BY Bug in SQL Server?

This is a discussion on ORDER BY Bug in SQL Server? within the SQL Server forums, part of the Microsoft SQL Server category; --> I believe I found a Bug in MS SQL Server 8.0. I have a query with an ORDER BY ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:51 PM
Andy Rohr
 
Posts: n/a
Default ORDER BY Bug in SQL Server?


I believe I found a Bug in MS SQL Server 8.0.


I have a query with an ORDER BY clause. The resultset is about 10000 rows.
Sometimes the ordering of the result is not correct, but when I restart the
sqlserver-process, at least the first time the ordering is correct, but then
after executeing the same query a few times, th ordering gets corrupt!


Has anybody encountered a simmilar Problem?

Does anybody know a workaround?


Thank a lot.

Andy Rohr.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:51 PM
David Portas
 
Posts: n/a
Default Re: ORDER BY Bug in SQL Server?

What do you mean by not correct? Can you post some code and sample data to
reproduce the problem (including the DDL)?

Do the columns in the ORDER BY list represent a unique key? If not, remember
that ORDER BY can produce different valid orderings if the columns are not
unique. For example, with the following query:

SELECT A, B
FROM Sometable
ORDER BY A

the result:
(1,1)
(1,2)

is just as valid as:
(1,2)
(1,1)

Also, in SQLServer ORDER BY columns reference aliased columns in the SELECT
list but can also reference base table columns which do not appear in the
SELECT list, a feature which can cause some confusion.

--
David Portas
------------
Please reply only to the newsgroup
--


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 05:51 PM
Andy Rohr
 
Posts: n/a
Default Re: ORDER BY Bug in SQL Server?

> Please reply only to the newsgroup

I repiled to microsoft.public.sqlserver.programming



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:35 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com