It only means what it says :-)
The error occurs because when using ORDER BY only the ordering of the final result set (that is returned to the client) is guaranteed. All intermediate result sets are just that - record sets - the order of elements in a set can vary. ORDER BY works with TOP because it restricts the result set based on the "view" set by ORDER BY , however, if this is not the top level of ORDER BY , it does not guarantee the order of the final one (only so that the "correct" TOP- records).
I.e
SELECT FOO FROM ( SELECT TOP 10 FOO FROM X ORDER BY FOO ASC) BAR
Does not have a guaranteed order of records in the final set of results; FOO values ββcan be displayed in any order.
Happy coding.
user166390
source share