create trigger tr_t1 on t1 after insert as if not exists(select 1 from deleted) insert t2 select id,value ,lastupdateddate from inserted where [no]='57' and itemno='38' else update t2 set [no]=i.[no] and itemno=i.[no] from t2 join inserted i on t2.ID=i.ID join deleted d on d.ID=i.ID where d.[no]='57' and d.itemno='38'
create trigger tr_t1 on t1 after insert,update--加上 as if not exists(select 1 from deleted) insert t2 select id,value ,lastupdateddate from inserted where [no]='57' and itemno='38' else update t2 set [no]=i.[no] and itemno=i.[no] from t2 join inserted i on t2.ID=i.ID join deleted d on d.ID=i.ID where d.[no]='57' and d.itemno='38'
after insert
as
if not exists(select 1 from deleted)
insert t2
select id,value ,lastupdateddate from inserted where [no]='57' and itemno='38'
else
update t2
set [no]=i.[no] and itemno=i.[no]
from t2 join inserted i on t2.ID=i.ID join deleted d on d.ID=i.ID
where d.[no]='57' and d.itemno='38'
after insert,update--加上
as
if not exists(select 1 from deleted)
insert t2
select id,value ,lastupdateddate from inserted where [no]='57' and itemno='38'
else
update t2
set [no]=i.[no] and itemno=i.[no]
from t2 join inserted i on t2.ID=i.ID join deleted d on d.ID=i.ID
where d.[no]='57' and d.itemno='38'