brgdotnet
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
--------------------------
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.