sql的delete怎样同时删除多个表中的记录?

2024-11-26 16:35:13
推荐回答(1个)
回答1:

针对第一个表写个删除触发器,使得删除第一个表的同时删除第二个表的数据。
create trigger del_tab on table1
for delete
as
if (select a from deleted)='N'
begin
delete from table2 where field b=N and c=N
end;