Is it possible to test two EXISTS conditions in a single IF SQL statement? I’ve tried the following.
IF EXIST (SELECT * FROM tblOne WHERE field1 = @parm1 AND field2 = @parm2)
OR
EXIST (SELECT * FROM tblTwo WHERE field1 = @parm5 AND field2 = @parm3)
I’ve tried playing with adding additional IF and parenthesis in there, but to no avail.
Can you help me out with the proper syntax?
If SQL Server
Is fine, note the only thing changed is
EXISTSnotEXIST. The plan for this will probably be aUNION ALLthat short circuits if the first one tested is true.