Bypassing Triggers

  • In the past I have used 2 techniques to by pass triggers. One is to create a dummy temp table on the connection and then check in the trigger for the temp table's existance. This method provideds a simple connection based bypass with automatic cleanup since the table is removed when the connection is closed.

      create table #dummy (dummy int)

    in Trigger:

        if Object_id('tempdb..#dummy') is not null


    The second method is to create a dummy global cursor and then check for the existance in the trigger.

      Declare TriggerSkipCursor Cursor Global For

        Select '1'


      Open TriggerSkipCursor

    in Trigger:

     if  CURSOR_STATUS('global', 'TriggerSkipCursor ') = 1


    Both these methods have worked well for us.




  • I wonder whether there can be some mechanism to fire a trigger when a database connection is closed. I want to log the time when the connection is closed.


Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply