Maya, Thanks for the reply. Yep, I know about the IF....ELSE...
But I need more conditions: IF @Myvar = 1 ELSE IF @Myvar = 2 ELSE for anything else With just the IF....ELSE... The only way I can get it to work is to add a control var @control = false IF @Myvar = 1 @control = true IF @Myvar = 2 @control = true IF @control = false Do this Just wondering if the IF....ELSE IF.....ELSE was possible. Or if I am missing a better way. Thanks Rodney -----Original Message----- From: Maya Tulchinsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 02, 2007 5:03 AM To: SQL Subject: Re: Conditional logic in SQL SPs 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2957 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6