Posted by Plamen Ratchev on 02/01/07 06:10
Just to add-on to Dan's response: in SQL Server 2000 using ORDER BY and TOP
100 PERCENT in views seemed to be a loophole that worked fine. In SQL Server
2005 that has been corrected and ORDER BY does not guarantee ordered
results. This is described very well in SQL Server 2005 BOL under the
section "Sorting Rows with ORDER BY":
"Although the view definition contains an ORDER BY clause, that ORDER BY
clause is used only to determine the rows returned by the TOP clause. When
querying the view itself, SQL Server does not guarantee the results will be
ordered, unless you specify so explicitly."
Regards,
Plamen Ratchev
http://www.SQLStudio.com
[Back to original message]
|