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:
01326730
Views:
19
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
>>
>
>SQL Server Help doesn't list the syntax you suggested.

It is the same as:
IF @Something1
   BEGIN
   -- Select 1
   END
ELSE
   IF @Something2
      BEGIN
          -- Select 2
      END
   ELSE
      IF @Something3
         BEGIN
         -- Select 3
         END
But is formatted that way it is hard to read, isn't it?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform