Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RaisError function
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
01466452
Message ID:
01466460
Views:
24
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform