0
在此存儲過程中,當@Id
爲5時,我想要使用Id的3和5獲取記錄。我該如何實現?存儲過程中字段的多值
CREATE PROCEDURE spEmployee
@EmployeeName NVarchar(100),
@Id int,
AS
SET NOCOUNT ON
SELECT *
FROM tblEmployees
WHERE EmployeeName = CASE
WHEN @EmployeeName IS NOT NULL
THEN @EmployeeName
ELSE EmployeeName
END
AND Department = CASE
WHEN @Id IS NOT NULL
THEN @Id
ELSE Id
END
GO
爲什麼我將代碼更改爲'@id = 5和Id = 3和Id = 2',它使我只是id = 5 –
@E_N_Y。 。 。我不知道'id = 2'來自哪裏。也許你的意思是'@id = 5和部門在(2,3)'中。 –