SQL Server sorting
In forums, people often ask the following questions:
Why is the result set of the same query sometimes arranged in the desired order, sometimes not, or in the order of SQL2000, to sql2005/2008?
In fact, as long as"Order", Sqlserver does not return in order. It is possible that an index has been created for a field in your table.
If you want the result set to be sorted by the indexed field, you do not specify"Order"There is no problem, because the table's storage order is based on that field
So you do not need to specifyOrder", But if you do not create an index for the field you want to sort, or create an index in SQL2000
Index, but the index is not created in sql2005/2008, it is necessary to explicitly use"Order. If you do not specify the same query,
It is normal that the order of the result set is different from the previous one.