标签:更改 sql from 结构 执行 lse highlight insert upd
首先建立两张表,分别为test1与test2,期望在更改test1的时候,test2的相关记录能够同时做出更改。假定test1与test2的表结构相同,如下表所示
name | age |
create trigger test3 on test1 after insert as insert into test2 select name,age from inserted
create trigger test4 on test1 after update as begin update test2 set age = a.age from test2,inserted as a where a.name = test2.name end
insert into test1 values (‘merle‘,‘99‘);
select * from test1;【merle 99】 select * from test2;【merle 99】
标签:更改 sql from 结构 执行 lse highlight insert upd
原文地址:https://www.cnblogs.com/merle/p/9262509.html