Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View not respecting ORDER BY clause
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01348243
Message ID:
01413853
Vues:
34
>>>>Hi all,
>>>>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?
>
>>It is mighty curious that SS lets you generate code it discards at run time.
>
>I agree with the intended design that M$ is keeping. The order by overhead is something that could IMPACT the plan and should be asked for after your where clause.
>
>I also thought that you coudl sneak around it with replacing ALL with top 100 percent. Maybe that only gets the TSQL debugger
>to allow you to use order by?
>
>In reality you could cream your tempdb with an order in a "distinct" view that returns millions of rows.

All that you say is true (although the Top 100 trick no longer works in SS 2008 from what I understand). Still, don't you think it's silly / misleading to let you think you have an Order By clause when in fact it is ignored? No wonder the blogger said he hears this question all the time.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform