O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 AdventureWorks2012 database, and the second sets recursive triggers to TRUE:

select DATABASEPROPERTYEX ('AdventureWorks2012', 'IsRecursiveTriggersEnabled')ALTER DATABASE AdventureWorks2012 SET RECURSIVE_TRIGGERS ON

If you turn off nested triggers, recursive triggers are automatically disabled, regardless of how the database option is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required