日期:2014-05-17 浏览次数:20615 次
create trigger t1
on tb
for update
as
begin
if exists(select 1 from inserted where num=2)
insert into change
select * from change
else exists(select 1 from inserted where num=3)
insert into change
select * from inserted
union
select * from deleted --插入式把num列的值改为3
end
create trigger t1
on tb
for update
as
begin
if update (num)
begin
if exists(select 1 from inserted where num=2)
insert into change
select * from inserted
where num = 2
if exists(select 1 from inserted where num=3)
insert into change
select * from inserted
where num = 3
union all
select d.col1,d.col2,num=3,d.col4... from deleted d,inserted i
where i.key = d.key
and i.num = 3
end
end