Thu 27 Aug 2009
There seems to be some misinformation going around about how SQL Server works with ordered data, especially with how the data is *physically* stored, even with a clustered-indexed table.
Please see this post for more details on SQL Server ordering: http://blogs.msdn.com/sqltips/archive/2005/07/20/441053.aspx
To add to that list a bit:
- Updates are (almost) the same as select queries, internally, in that updates are turned into selects internally, which means the ordering rules of selects are also at play
- Updates can have parallelism, meaning that updates do not have to preserve update order
- Update order can’t be guaranteed because clustered indexes can be rebuilt with a different order
- Ordering generally happens at the operator level within a query plan; not at the top
- Unless you’ve seen it in BOL or in a MS Blog post, don’t assume anything with respect to SQL Server ordering – even if your queries operate on a given order today!