What can cause SQL server 2005 to return the results of a SELECT in a different order.
Note:
I don’t know if that matters but the query has an Order by clause on a non-unique column (Date column to be specific) and the table is a temp table.
Edit:
I know that the order is not guaranteed if I wont specify it, but it usually consistent until something happens.
I want to know what is this “something” that can happen.
Thanks.
If ordered by a non-unique column, then after the guranteed ordering of that column, the order of the rows within a given group is not guranteed – as awm said, it’s down to the database. An insert can change the order, joins can change the order, an update can potentially change the order.
If you want guranteed order, then specify a set of columns in your
order bythat will gurantee order.