SQL Server Management Studio's ordered view
-
Actually I wanted to post a "normal" programming question, but a search thru the web showed me that Microsoft produced a coding horror: In SQL Server Management Studio, create a view and add an "ORDER BY" clause. When you are still in the designer, and click the "!" to execute the view, the result will be as expected: correctly sorted. Now save the view, and and query its data. Never will you get the expected sort order... See http://connect.microsoft.com/SQLServer/feedback/details/249248/management-studio-generates-invalid-top-100-percent-order-by-in-views[^]
-
Actually I wanted to post a "normal" programming question, but a search thru the web showed me that Microsoft produced a coding horror: In SQL Server Management Studio, create a view and add an "ORDER BY" clause. When you are still in the designer, and click the "!" to execute the view, the result will be as expected: correctly sorted. Now save the view, and and query its data. Never will you get the expected sort order... See http://connect.microsoft.com/SQLServer/feedback/details/249248/management-studio-generates-invalid-top-100-percent-order-by-in-views[^]
The horror is allowing creation of a view with an order by in the first place. X| Just say no.
-
The horror is allowing creation of a view with an order by in the first place. X| Just say no.
My thoughts exactly.
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
The horror is allowing creation of a view with an order by in the first place. X| Just say no.
Well, Order By is of some use, even in views. But it should ALWAYS be paired with a TOP(X).
SELECT TOP 100 PERCENT *
FROM Somewhere
ORDER BY whateveris a true, classic, horror.