sachin6139 (6/4/2013)
I have 2 select statements. One with NOLOCK hint and other without NOLOCK hint. I am getting different result sets. Rows are same but there order is different. Why?
SQLServer never, ever guarantees that results will be in any order unless an explicit ORDER BY is added to a query.
If order is important, you have to tell SQL to use an Order By.
the engine will use various indexes to get the data in what it determines is the fastest way possible; because the two queries are not the same, the apparent order is not duplicated between the two.
even the same query repeated multiple times can be affected by parallelism, SET options, statsitics being updated and much much more.
Lowell