SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

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


Vivek's SQL Notes

Vivek johari is currently a Analyst and have more that 5.5 yeras of experience in database. He has Master degree in Computer and also he is Microsoft certified Sql DBA (MCTS)& Microsoft certified SQl BI professional(MCTS). He is also Oracle certified profession(OCP)DBA in ORACLE 10g and ORACLE 9i.He has the experience of working in PL/SQL, T-SQL and SSIS/SSRS. His work basically involved designing and optimization of the Database.He has also published many database articles on his blog Technologies with Vivek Johari.

Comments

Leave a comment on the original post [feedproxy.google.com, opens in a new window]

Loading comments...