I have two identical select statements. One uses Variables and the other uses actual hard coded values but for some reason they return data in a different order.
If you want a specific order, then use the ORDER BY clause. Without specifying an ORDER BY, the DBMS is free to return the records in any order it wants.
Also look at your query execution plan, is it the same for both?
“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.