Get all Triggers with Table Names in SQL Server

Often we come across situation where we need to find out the list of Tables on which triggers are enable. The below query will provide you list of all tables with triggers created on them.

SELECT                   AS TableName,
Schema_name(TBL.schema_id) AS Table_SchemaName,                   AS TriggerName,
WHEN TRG.is_disabled = 0 THEN 'Enable'
ELSE 'Disable'
END                        AS TRG_Status 

FROM   sys.triggers TRG
INNER JOIN sys.tables TBL
ON TBL.OBJECT_ID = TRG.parent_id 

Get Table Names with Triggers in SQL Server Database

1 comment: