Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View not respecting ORDER BY clause
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01348243
Message ID:
01348288
Views:
25
>>>Hi all,
>>>
>>>Got a weird one here. I create a *simple* view in the SQL 2005 View Designer:
>>>
>>>SELECT ALL
>>>guiUniqueID, chvCollectionKey, chvCaption, chvClassLibrary,
>>>chvClassName, chvParentNode, inyNodeLevel, insNodeSequence, 
>>>inyNodePlacement, bitExternalProcess, dtmCreated, chvCreator, dtmUpdated, chvUpdater
>>>FROM Control.TreeViewNodes
>>>ORDER BY inyNodeLevel, insNodeSequence
>>>
>>>When I execute the code in the View Designer, all is well. However, when I execute the view from either a query or by right-clicking the view name and choosing Open View, the ORDER BY clause does not function correctly. I get the correct quantity and selection of rows that I expect -- they're just not in the correct order.
>>>
>>>What stupidly simple thing am I doing wrong here?
>>>
>>>TIA,
>>
>>I just tried it in SSMS (added order to one of my views) and got the same behavior. I guess it's either a bug or by design.
>
>If it's a bug, it's a MAJOR one...can't help but thinking it's not a bug, though.

I think its standard behaviour. If you do a Select without specifying an order then no order is quaranteed - the fact that you are selecting from a view that was itself ordered is not relevant.

Regards,
Viv
Previous
Reply
Map
View

Click here to load this message in the networking platform