SQL Server 2005: How to Disable a Trigger

Posted September 26, 2008 by Rob Rogers in Database

A trigger allows for the execution of SQL code anytime an UPDATE, INSERT, or DELETE command is performed on a certain table. If you are having to perform manual modifications to the table, you may not want the trigger to fire off. Here’s how to disable the trigger so that you can perform your administrative tasks:


To disable the trigger, open a query window and use the following command (inserting the proper Table Name and Trigger Name into the statement):
ALTER TABLE <Table Name> DISABLE TRIGGER <Trigger Name>

To enable the trigger, use the following command (inserting the proper Table Name and Trigger Name into the statement):
ALTER TABLE <Table Name> ENABLE TRIGGER <Trigger Name>

 

About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.