Monday, January 13, 2014

SQL - List All Triggers In A Database

I needed to get a list of all of the triggers in a database. This is the script that I used:

select as [Table Name], as [Trigger Name], sysM.definition as [Trigger Script] from  sys.tables sysT
inner join sys.objects sysO on sysT.object_id = sysO.parent_object_id
inner join sys.sql_modules sysM on sysO.object_id = sysM.object_id 
where sysO.type ='TR'

No comments:

Post a Comment

Thank you for commenting!