create trigger t1_insert on table1
for update
as
insert table2
select getdate(),id, name from inserted
where datediff(mi,sj,getdate())>1
go
for update
as
insert table2
select getdate(),id, name from inserted
where datediff(mi,sj,getdate())>1
go
for update
as
insert table2
select getdate(),sj,id, name from inserted
where datediff(mi,sj,getdate())>1
go注意:时间较小的一个值放在前面。
datediff(mi,sj,getdate())
for update
as
insert 表2
select getdate(),'修改记录',id,name from inserted where not exists(select f1 from 表1 where datediff(mi,时间,getdate())=0)
for update
as
insert 表2
select getdate(),'修改记录',id,name from inserted where datediff(mi,sj,getdate())>0)