Using DMO to Enable/Disable Triggers
January 14, 2001
These code samples illustrate how to enable and disable all triggers in a database at one time - a task not easily done otherwise! If you haven't use DMO before, I've posted two articles that you may find informative - Introduction to SQL-DMO and More DMO.
If you wanted to do this using plain vanilla SQL you would need to create a script that had one "Alter Table xx Disable Trigger yy" statement per trigger. As written these should run in VBScript or as an ActiveX job. If you would like to use them in VB you should set a reference to the SQL-DMO object library so that you get statement completion and can do strong data typing. One advantage to using code for a task like this is you can easily modify it to only run on tables that start with 'A' or on triggers that contact the word 'Insert' in their name.