Thursday, February 9, 2012

T-SQL: Disable/Enable trigger script

Disable trigger script

USE AdventureWorks
--Make sure we are in the correct DB

ALTER TABLE HumanResources.Employee DISABLE TRIGGER HumanResources.dEmployee
--disabletrigger from a specific table

Enable trigger script

USE AdventureWorks
--Make sure we are in the correct DB

ALTER TABLE HumanResources.Employee ENABLE TRIGGER HumanResources.dEmployee
--enable trigger from a specific table

Erros encountered

When using the following script

ENABLE TRIGGER HumanResources.dEmployee ON HumanResources.Employee

I was getting the error

Error Message : Incorrect syntax near 'ENABLE'.

Using the version indicated above using the ALTER TABLE syntax, solved this issue

No comments:

Post a Comment