create trigger t_update
on table1
after
as
set xact_abort on
begin tranupdate table2
set b.name2=a.name1
from Inserted a,table2 b where a.id=b.id
commit tran
go
on table1
after
as
set xact_abort on
begin tranupdate table2
set b.name2=a.name1
from Inserted a,table2 b where a.id=b.id
commit tran
go
on table1
for insert
after
as
set xact_abort on
begin tranupdate table2
set b.name2=a.name1
from Inserted a,table2 b where a.id=b.id
commit tran
go
on table1
for update
as
update table2
set a.name2=d.name1
from Inserted i,Deleted d,table2 a
where a.id=i.id
GO
on table1
for update
as
update a set a.name=b.name
from inserted b ,table2 a where b.id=a.id
on table1
for update
as
update dbName.dbo.table2
set name2=d.name1
from Inserted i,Deleted d,dbName.dbo.table2 a
where a.id=i.id
GO
将table2改为base2..table2
on base1..tb1
for update
as
update a set a.[name]=b.[name]
from inserted b ,base2..tb2 a where b.id=a.id