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 2005 Forums
 Transact-SQL (2005)
 Not using orderby - In which order return

Author  Topic 

agathee
Starting Member

1 Post

Posted - 2009-06-16 : 06:21:12
if i am not using a order by in my query. Then in which order the result will be returned

For Eg.,

select * from employee order by name

The above query result will be returned in the order name wise.

select * from employee

In which order the result will be returned

Agathee

kishore_pen
Starting Member

49 Posts

Posted - 2009-06-16 : 06:37:39
If any Indexes exists, it will use it.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-16 : 06:44:15
It will probably scan the clustered index, if such exists, due to the "*" wildcard character.
But even so, there is no guarantee records are returned in same order as clustered index.
Parallellism and other things will interfere.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -