Disabling Triggers

To prevent triggers from running when data arrives through replication, you can add the NOT FOR REPLICATION option to the CREATE TRIGGER or ALTER TRIGGER statements. In this case, the trigger will fire on direct modifications to the base table, but not from subscription actions.

Temporarily, you can disable a trigger to speed up some processes. To do so, you can use the ALTER TABLE statement with the DISABLE TRIGGER option, as in Listing 9.18.

Code Listing 9.18. You Can Disable a Trigger
					 USE Northwind GO -- To disable a single trigger ALTER TABLE Employees DISABLE TRIGGER tr_Employees --, isr_Employees, udt_Employees ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.