CREATE TRIGGER [tr_a] ON [dbo].student
FOR UPDATE
AS
declare @aa int
if update(math)
begin
select @aa=math from inserted
if @aa>=60
raiserror ('数学成绩是及格的,不能更新')
else
update A
set A.math=B.math
from student A inner join deleted B on A.s_id=B.s_id
end
FOR UPDATE
AS
declare @aa int
if update(math)
begin
select @aa=math from inserted
if @aa>=60
raiserror ('数学成绩是及格的,不能更新')
else
update A
set A.math=B.math
from student A inner join deleted B on A.s_id=B.s_id
end
FOR UPDATE
AS
declare @aa int
if update(math)
begin
select @aa=math from deleted
if @aa>=60
raiserror ('数学成绩是及格的,不能更新')
else
update A
set A.math=B.math
from student A inner join inserted B on A.s_id=B.s_id
end