Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Default order if order by values are all equal

Author  Topic 

britanb
Starting Member

2 Posts

Posted - 2012-06-06 : 05:38:15
Hi,

I am wondering what is the default order if all of the columns in the order by has the same value? How does SQL treat them?

Thanks

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-06 : 06:09:16
Unpredictable. Depends on how the query is executed and the storage chain. The order can change at any time.
In general if an index is used the rows will be returned in order of that index but parallelism and joins can affect that.

Same as if you don't have an order by clause.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

britanb
Starting Member

2 Posts

Posted - 2012-06-06 : 08:00:46
Thanks nigelrivett. This helped cleared up some things.
Go to Top of Page
   

- Advertisement -