基于一个参数,我想在我的存储过程中执行不同的更新。我已经尝试了下面代码的许多排列,但我总是有错误。
@EmpID int = 0,
@NewStatus nvarchar(10) = 0
AS
BEGIN
SET NOCOUNT ON;
select CASE @NewStatus
when 'InOffice' then
Update tblEmployee set InOffice = -1 where EmpID = @EmpID
when 'OutOffice' then
Update tblEmployee set InOffice = -1 where EmpID = @EmpID
when 'Home' then
Update tblEmployee set Home = -1 where EmpID = @EmpID
END