0
CREATE table1;
CREATE table2;

CREATE trigger1 ON table1 AFTER DELETE AS DELETE FROM table1;
CREATE trigger2 ON table1 AFTER DELETE AS DELETE FROM table2;

DELETE FROM table1

最后一个查询将触发trigger1并且trigger2.

是否再次trigger1触发trigger2(如果设置了数据库默认选项)?

4

2 回答 2

1

这取决于nested triggers服务器上的设置。看:

http://msdn.microsoft.com/en-us/library/ms190739.aspx

于 2013-02-20T18:06:05.417 回答
1

如果选项 RECURSIVE_TRIGGERS 设置为 on 并且配置“嵌套触发器”设置为 1,那么是的触发 trigger1 将导致 trigger1 和 trigger2 再次触发,然后再次触发,直到触发后的深度达到 32 级。否则,他们不会递归触发。

于 2013-02-20T18:10:51.873 回答