CREATE TRIGGER 名2 ON table2
FOR update
AS
update table1 set field1=aa.field1+aa.field2 from inserted aa where aa.编号=table1.编号
FOR update
AS
update table1 set field1=aa.field1+aa.field2 from inserted aa where aa.编号=table1.编号
FOR update
AS
update table1 set field1=a.field1+a.field2 from inserted a where 条件
GO
for update
as
update 表1 set table1.field1=table2.field1+table2.field2
go
go !~go!go !
for update
as
update 表1 set table1.field1=table2.field1+table2.field2
go
CREATE TRIGGER 名2 ON table2
FOR update
AS
update a set a.field1=b.field1+b.field2
from table1 a
join inserted b on a.编号 = b.编号
不过要注意是哪种执行方式:UPDATE,INSERT ,DELETE
此外还要注意是什么情况下触发?BEFORE,还是AFTER?
for update
as
update table1 set field1=a.field1+a.field2 from inserted a where table1.主键=a.主键
FOR update
AS
update table1 set field1=a.field1+a.field2 from inserted a where a.id=table1.id