我正在尝试执行以下 SQL 2008 代码,它说“=”和“else”附近有问题......我无法理解代码有什么问题
ALTER PROCEDURE dbo.LoginEmp @username NVARCHAR(10),
@password NVARCHAR(10),
@confirm INT output,
@emp_name NVARCHAR(50) output,
@emp_id BIGINT output
AS
IF EXISTS (SELECT @emp_id = emp_id,
@emp_name = emp_name_ara
FROM Employee
WHERE ( emp_username LIKE @username
AND emp_password LIKE @password ))
BEGIN
SET @confirm=1
INSERT INTO EmployeeLog
(log_emp_id,
log_act_id,
log_date,
log_data)
VALUES (@emp_id,
1,
GETDATE(),
-1)
END
ELSE
BEGIN
SET @confirm=0
END
RETURN