如何为触发器赋值
求教啊 如何为触发器赋值
------解决方案--------------------
ALTER TRIGGER T_CourseSchedule_UpdateFlag
ON T_CourseSchedule
AFTER UPDATE
AS
DECLARE @courseID int,@oldflag int,@newFlag int
IF UPDATE([flag])
BEGIN
SELECT @oldflag=flag from inserted
SELECT @newFlag=flag from inserted
SELECT @courseID=courseID FROM inserted
UPDATE T_SelectQuestionBank SET flag=@newFlag where courseID=@courseID
--UPDATE T_SelectQuestionBank SET flag=0
END
GO
UPDATE T_CourseSchedule SET flag=1 WHERE courseID=5