Using Recursive Triggers

Recursive triggers were introduced in SQL Server 7.0. If a trigger modifies the same table where the trigger was created, the trigger does not fire again unless the recursive triggers option is turned on. recursive triggers is a database option turned off by default.

The first command in the following example checks the setting of recursive triggers for the BigPubs2008 database, and the second sets recursive triggers to TRUE:

image

If you turn off nested triggers, recursive triggers are automatically disabled, regardless of how the database option is set. The maximum nesting level for recursive triggers is the same as for ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.