我写的只能更新当前父节点,不能更新下一个父节点
sql server中update触发器怎么在一个表中连续触发
答案:3 悬赏:50
解决时间 2021-04-28 06:08
- 提问者网友:野性
- 2021-04-27 10:27
最佳答案
- 二级知识专家网友:哭不代表软弱
- 2021-04-27 11:57
你直接在触发器里面加上update语句就行了,用分号隔开
before update
begin
update tablea set a.col=? where a.col1=inserted.col1;
update tableb set b.col=? where b.col1=(select a.col2 from tablea where a.col1=inserted.col1);
。。。
end
before update
begin
update tablea set a.col=? where a.col1=inserted.col1;
update tableb set b.col=? where b.col1=(select a.col2 from tablea where a.col1=inserted.col1);
。。。
end
全部回答
- 1楼网友:一池湖水
- 2021-04-27 14:23
触发器的代码:
create trigger tri_name
on table_name
for insert
把tri_name 修改一下,把 on table_name修改成新表名 on new_table_name
就可以了。
- 2楼网友:滚出爷的世界
- 2021-04-27 13:01
更新记账的语句写法如下:
先将选择的记录插入了一张临时表中,
insert into 临时表(lsbh,djbh) from (0001,'13010001')
insert into 临时表(lsbh,djbh) from (0002,'13010002')
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息