写一个 a 表的触发器,当删除 a 表的时候,删除与 a 表通过 acc_id 字段相关联的表 b,怎么写?

Zi_Yuan 2009-03-06 04:54:03
写一个 a 表的触发器,当删除 a 表的时候,删除与 a 表通过 acc_id 字段相关联的表 b,怎么写?谢谢!
...全文
56 7 点赞 打赏 收藏 举报
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
kn731 2009-03-06
不知道..但是帮你顶!
  • 打赏
  • 举报
回复
sdhdy 2009-03-06

create trigger tri_a_delete on a
for delete
as
delete b from deleted a where a.acc_id =b.acc_id
  • 打赏
  • 举报
回复
dawugui 2009-03-06
create trigger my_trig on a for delete
as
delete B from B , deleted t where b.acc_id = t.acc_id
go
  • 打赏
  • 举报
回复
dawugui 2009-03-06
[code=SQL]create trigger my_trig on a for delete
as
delete B from B , deleted t where b.acc_id = t.acc_id
go
[/code]
  • 打赏
  • 举报
回复
快乐_石头 2009-03-06
CREATE TRIGGER TRI_DEL ON TA
FOR DELETE
AS
DELETE B FROM DELETED WHERE acc_id=DELETED.acc_id
  • 打赏
  • 举报
回复
Zi_Yuan 2009-03-06
写一个 a 表的触发器,当删除 a 表的时候,删除与 a 表通过 acc_id 字段相关联的记录,条件是a.acc_id=b.acc_id,怎么写?谢谢!
  • 打赏
  • 举报
回复
快乐_石头 2009-03-06
CREATE TRIGGER TRI_DEL
FOR DELETE
AS
DELETE B FROM DELETED WHERE acc_id=DELETED.DELETED
  • 打赏
  • 举报
回复
相关推荐
发帖
MS-SQL Server
加入

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2009-03-06 04:54
社区公告
暂无公告