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 TBL.name                   AS TableName,
      
Schema_name(TBL.schema_id) AS Table_SchemaName,
      
TRG.name                   AS TriggerName,
      
TRG.parent_class_desc,
      
CASE
        
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

2 comments:

  1. how can we find the list of tables in database which are not having triggers

    ReplyDelete