Wednesday, March 28, 2012

if elseif .. in Store procedure:

Could anyone tell me the sytnax of IF command in store procedure ?
if ..
elseif ...
Thanks a lo.t
Does any tutorial web site teach about SP sytnax ?
There is no ElseIF but you can nest multiple Else's:
IF X = 1
...
ELSE
IF X = 2
...
ELSE
IF X = 3
...
Andrew J. Kelly SQL MVP
"Agnes" <agnes@.dynamictech.com.hk> wrote in message
news:u9QY2UrDFHA.2632@.TK2MSFTNGP12.phx.gbl...
> Could anyone tell me the sytnax of IF command in store procedure ?
> if ..
> elseif ...
> Thanks a lo.t
> Does any tutorial web site teach about SP sytnax ?
>
|||You can make it a bit more like an elseif, if you put the ELSE and IF on the
same lines:
IF 1 = 0
PRINT 1
ELSE IF 1 = 2
PRINT 2
ELSE
PRINT 3
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:es4sKgrDFHA.2756@.TK2MSFTNGP15.phx.gbl...
> There is no ElseIF but you can nest multiple Else's:
>
> IF X = 1
> ...
> ELSE
> IF X = 2
> ...
> ELSE
> IF X = 3
> ...
> --
> Andrew J. Kelly SQL MVP
>
> "Agnes" <agnes@.dynamictech.com.hk> wrote in message
> news:u9QY2UrDFHA.2632@.TK2MSFTNGP12.phx.gbl...
>

No comments:

Post a Comment