You can use IF - ELSE
IF Boolean_expression
BEGIN
{ sql_statement | statement_block }
END
ELSE
BEGIN
{ sql_statement | statement_block }
END
http://msdn2.microsoft.com/en-us/library/aa258850(sql.80).aspx
Hope this helps
Maya
"Bruce, Rodney S Mr CTR USA AMC" <[EMAIL PROTECTED]> wrote: Hi,
Does SQL (MS SQL 2005) SPs allow/have: IF ELSEIF ELSE,
structure?
IF something = 1
ELSEIF something = 2
ELSE something = anything else
OR
a SWITCH/CASE?
I can find examples for inside a query
Select f1,f2
Case f1
WHERE '1' then this
WHERE '2' then something else
But can not find an example for:
CASE @MyVar
WHERE '1' then
BEGIN
Select *
From Mytable
End
Where '2' then
Begin
Select *
From Mytable2
End
Any help would be appreciated.
Thanks
Rodney
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2956
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6