Triggers

  • How To Enable or Disable ALL Triggers on a Single Database?

  • Example

    DISABLE TRIGGER employee.uAddress ON Employee.Address;

    GO

    ENABLE Trigger employee.uAddress ON Employee.Address;

    Syntax

    ENABLE TRIGGER { [ schema_name . ] trigger_name [ ,...n ] | ALL }

    ON { object_name | DATABASE | ALL SERVER } [ ; ]

  • http://www.mssqltips.com/tip.asp?tip=1380

    has lots of tips for disabling. u can use similar steps for enabling.



    Pradeep Singh

  • Like this...

    [font="Courier New"]--===== Disable all triggers on user tables in database

    DECLARE @SQL VARCHAR(MAX)

     SELECT @SQL =''

     SELECT @SQL = @SQL + 

                 + 'DISABLE TRIGGER ALL ON ' + Table_Schema + '.' +Table_Name +';'

       FROM Information_Schema.Tables

      WHERE Table_Type = 'BASE TABLE'

       EXEC (@SQL)

    --===== Enable all triggers on user tables in database

    DECLARE @SQL VARCHAR(MAX)

     SELECT @SQL =''

     SELECT @SQL = @SQL + 

                 + 'ENABLE TRIGGER ALL ON ' + Table_Schema + '.' +Table_Name +';'

       FROM Information_Schema.Tables

      WHERE Table_Type = 'BASE TABLE'

       EXEC (@SQL)[/font]

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thanks Jeff Moden,

    Thank u very much for my help

  • Thanks Pradeep Singh,

    Thank u very much:-)

  • Thanks Pradeep Singh,

    Thank u very much:-)

  • vishal_mca2005 (6/13/2009)


    Thanks Jeff Moden,

    Thank u very much for my help

    Thank you for the feedback.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 7 (of 7 total)

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