SQL Server triggers burn each other Question

I have an audit trigger that automatically sets the time when something was updated, and the user updated in the fields in all of my tables. I have another set of triggers that write information about events from updates to the event table. The problem is that someone is updating something, event information is triggered twice because of the first triggers. How to suppress duplicate entries?

+3
source share
4 answers

Take a look at the function TRIGGER_NESTLEVEL. It returns the current trigger nesting level. You can check this to prevent duplicates.

+1
source

I think you have 2 options:

  • Combine both sets of triggers into one.

  • , .

+1

, ( - ). (Sql 2005), sp_configure, . , .

exec sp_configure " ", 0

+1

SS2005, SS Mgt Studio , , "". "" " " "".

0
source

Source: https://habr.com/ru/post/1699391/


All Articles