Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DO CASE equavalent in Transact-SQL
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01326640
Message ID:
01326681
Views:
16
This message has been marked as a message which has helped to the initial question of the thread.
>>What's wrong with one SP. You always can use structure like this:
>>
>>IF @Something1
>>   BEGIN
>>   -- Select 1
>>   END
>>ELSE IF @Something2
>>   BEGIN
>>   -- Select 2
>>   END
>>ELSE IF @Something3
>>   BEGIN
>>   -- Select 3
>>   END
>>
>
>That's exactly what I'm writing at the moment but I didn't know what it should be ELSE IF.
>
>BTW, I think I don't need BEGIN/END if I only have just one select command, am I right?

Correct, although personally I always enclose statements in an IF with BEGIN..END just to help readability.

>
>And I have another SQL question regarding projection. For some reason the code my colleague tried didn't work for me with the strange error.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform