Blog Post

SQL Script to find all the triggers defined on a database or on a single table

,

Sometime we need to find all the triggers defined on the database. So in this case, we can use the below SQL Query:-

SELECT
       tbl.name as [Table Name]
     , trig.name as [Trigger Name]
     , trig.is_disabled 
FROM [sys].[triggers] as trig
INNER JOIN sys.tables as tbl
ON trig.parent_id = tbl.object_id 

In case, if we need to find out all the triggers defined on a particular table then we can use the below SQL script

SELECT
       tbl.name as [Table Name]
     , trig.name as [Trigger Name]
     , trig.is_disabled 
FROM [sys].[triggers] as trig
inner join sys.tables as tbl
on trig.parent_id = tbl.object_id 
where tbl.name='Tblname'

/*  where Tblname name is the name of the table*/


Related article

SQL Triggers - An Introduction

Keep learning and don't forget to gives feedback on the article. You can also send feedback to me on my mailid  askvivekjohari@gmail.com

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating