Disable Enable Trigger SQL server for a table
Solution 1:
use the following commands instead:
ALTER TABLE table_name DISABLE TRIGGER tr_name
ALTER TABLE table_name ENABLE TRIGGER tr_name
Solution 2:
The line before needs to end with a ;
because in SQL DISABLE
is not a keyword. For example:
BEGIN
;
DISABLE TRIGGER ...
Solution 3:
As Mark mentioned, the previous statement should be ended in semi-colon. So you can use:
; DISABLE TRIGGER dbo.tr_name ON dbo.table_name
Solution 4:
After the ENABLE TRIGGER OR DISABLE TRIGGER in a new line write GO, Example:
DISABLE TRIGGER dbo.tr_name ON dbo.table_name
GO
-- some update statement
ENABLE TRIGGER dbo.tr_name ON dbo.table_name
GO