Disable trigger without using ALTER Table

  • Hi to all... I need to disable a trigger in my database of a table that it is published by a transactional replication... so I cannot use

    ALTER TABLE tabNAme

    DISABLE TRIGGER TriName.

    Does anyone else know a way to disable a trigger without using alter table syntax?

     

    Thanks in advanced.

  • I use ALTER TRIGGER and put a Return statement before any active TSQL. Then when I'm done I just remove the Return statement.

    If you need to do this on more than one trigger at a time you can create an SP to read the syscomments table and put the tsql in a working table. Then dynamically create the SQL from the working table to put it back. I've been using something similar for the last 2 years with no problems.




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

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

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