Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

IF else end structure when doing an IF EXISTS statement

I want like an if then else structure when I use an IF EXISTS CLAUSE. In that case would the code below be correct where I have two BEGIN END statements ?
---------------------------------
IF  EXISTS ( SELECT Code from zoop where Code = @newPLAYERId)
BEGIN
update zoop
    set Code = '####'  
    from zoop t
    where t.DateEntered > ( select min(x.DateEntered) from zoop x ) -- AND SUBSTRING(t.Code,1,1) = 'A'
END
ELSE
BEGIN

END
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial