Search code examples
sql-serverssms

Cannot disable trigger on {table} as the target is not in the current database


I was trying to disable all triggers on a SQL Server table to delete some rows, then wanted to enable the triggers back on.

But disable triggers command is causing an error.

Command:

DISABLE TRIGGER ALL ON [PTS].[dbo].[cadResources]

Error

Cannot disable trigger on 'PTS.dbo.cadResources' as the target is not in the current database.


Solution

  • You should do

    USE [PTS]
    DISABLE TRIGGER ALL ON [dbo].[cadResources]