Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Unless you have an explicit ORDER BY clause, there is NO implicit ordering (there is no "original order from DB") in a SQL Server environment.
mean to say, in a small database of say, 1 Lak of records, it does not preserve insertion order (even though there are no concurrent inserts).
Even during sequential inserts, it does not preserve order. This is quite different from MySQL experience.

I beleive it is true!!

So if we are selecting the details from the database, may be the row order will change if we are not using the order by clause...

Ex:select * from emp;

is it correct??
Posted
Updated 1-Jun-12 5:59am
v3

This is what I found out:

SELECT is a set-oriented operation and, as sets are unordered, no specific order in the resultset is guaranteed, unless you explicitly use ORDER BY.
 
Share this answer
 
Comments
Maciej Los 1-Jun-12 15:06pm    
Good answer, my 5!
Order by may not change order in a database. Yes, it's used only for listing the data.

More at: ORDER BY[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900