如果永远不会奏效。总是陷入其他条件。我已调试并检查@nextapprover不为空。
IF (@nextApprover != NULL)
BEGIN
UPDATE CallWatching
SET EmployeeNo = @employeeNo
WHERE @SRFID = MasterCode;
INSERT INTO CallForwarding (
MasterCode
,EmployeeNo
,ApproverNo
,IsForwarded
,ForwardBy
)
VALUES (
@SRFID
,@EmployeeNo
,@nextApprover
,0
,@EmployeeNo
)
END
ELSE
BEGIN
UPDATE CallWatching
SET STATUS = 1
WHERE @SRFID = MasterCode;
END
答案 0 :(得分:5)
使用IS NOT NULL
即。变更:if(@nextApprover!=null)
到IF(@nextApprover IS NOT NULL)
此外,您应该<>
而不是!=
,因为它符合ANSI标准