Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RaisError function
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
01466452
Message ID:
01466460
Vues:
25
>My purpose in using IF NOT EXISTS was to determine if I did not receive a result, and to determine if I did receive a result. Crazy, eh? Anyway, I only wanted to use RAISERROR because the instructor told us we had to use it. I'll pull the ORDER BY out, but that was also requested by the instructor.
>
>>If you're using
>
>>IF NOT EXISTS (select ...)
>
>>then, as I said, get rid of the ORDER BY.
>
>>Otherwise, can you show the exact piece of code which is failing?

Cecil,

You need to understand, that EXISTS doesn't select the data, if only verifies condition and immediately returns if the condition is met. Therefore the ORDER BY in the EXISTS select statement in useless and should not be there unless you check for TOP (N).

The Raiserror usage is OK in that context.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform