I have an SP where I need to check if the condition is met
ALTER PROCEDURE [dbo].[spCheck] @strEmpname VARCHAR(50), @intReturn INT OUTPUT, @intWorkdID INT, @intEmpID INT AS BEGIN IF(@intWorkdID is not null and @intWorkdID != '') BEGIN IF EXISTS ( SELECT * FROM Employee WHERE [Empname] = @strEmpname AND WorkID = @intWorkdID ) SELECT @intReturn = '1' END ELSE IF(@intEmpID is not null and @intEmpID != '') BEGIN IF EXISTS ( SELECT * FROM Employee WHERE [Empname] = @strEmpname AND PeopleID = @intEmpID ) SELECT @intReturn = '1' END ELSE IF(@intEmpID is not null and @intEmpID != '') and(@intWorkdID is not null and @intWorkdID != '') BEGIN SELECT @intReturn = '0' END END
here based on WorkID, EmpID
1 condition and condition 2 must fulfill
if both conditions do not work, I need to fix the third condition
can anyone tell the syntax for it
thanks
Prince
source share