A trigger execution may occured another trigger execution or same trigger execution. This trigger called Nested Trigger Or Recursive Trigger. SQL Server allows maximum 32 Level recursion.
Disable Nesting/Recursing Triggers
Method 1:
sp_CONFIGURE 'nested_triggers',0
GO
RECONFIGURE
GO
Method 2:
ALTER DATABASE databasename
SET RECURSIVE_TRIGGERS ON | OFF
Method 3:
Restrict Trigger Nesting to certain level.
Put following script in trigger code. This will stop the trigger recursion after certain levels. In following case it will stop after 5 recursion.
IF ((
SELECT TRIGGER_NESTLEVEL()) > 5 )
RETURN
No comments:
Post a Comment