Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Good practice to separate If Endif
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
01681311
Message ID:
01681415
Views:
32
Actually I find that I like and will find useful the syntax GOTO someLabel. I hope it works back in SQL Server 2008 (I think this is the "oldest" version of SQL used by my customers).
Thanks for bringing it up.

>Hi,
>
>T-SQL is really very limited language in terms of the things like SWITCH (or CASE). You would need to do
>
>IF 
>  begin
>    code here
>  end
>ELSE
>   begin
>       IF other condition
>           begin
>             some code
>            end
>    END
>
>
>In T-SQL you can use GOTO someLabel. I don't like this construct myself, but here I see it used a lot in the stored procedures.
>
>>Hi,
>>
>>I am troubleshooting a fairly large stored procedure. And I think the issue is that some IF - ENDIF do not separate various conditions. Even though I use BEGIN and END.
>>What is a good practice to separate various IF conditions in a stored procedure?
>>
>>TIA
>>
>>UPDATE. I also wanted to find out if there is a way to use ELSEIF in a stored procedure. I know you can do ELSE, but if I wanted to have multiple conditions, ELSEIF would be helpful. Or, is CASE - END the only way to have multiple conditions.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform