sql 中创建删除触发器

2025-04-03 03:34:28
推荐回答(2个)
回答1:

Sqlserver:
create trigger tr_A
on A for delete as
begin
delete B from B,deleted D where B.id=D.id
end

Oracle:
Create Or Replace Trigger tr_A
After Delete On A
For Each Row
Begin
Delete From B Where id=:Old.id;
End;

假设主键为 ID

回答2:

上面的不错,可以试试,他回答了我就不说了