Find all Triggers

I was asked to find all tables in a database that had a DML trigger so a developer could ensure that all the old functionality was available in the new database.  So once I built my query to give me the information, I thought I’d save it here for future use.

select a.name as ‘Trigger’, b.name as ‘Table’
from sysobjects a
join sysobjects b
on a.parent_obj=b.id
where a.xtype = ‘TR’

This gave me a nice little result set of each trigger and what table it was associated.  Maybe I won’t have to re-invent the wheel the next time they ask.

Tags: , ,

One Response to “Find all Triggers”

  1. SQLRockstar says:

    funny, i just put together some t-sql for finding triggers as well:

    SELECT name, OBJECT_NAME(parent_id), is_disabled as [Parent Object] FROM sys.triggers

    i use sys.triggers because it includes DDL triggers, which are not in the sysobjects table.

Leave a Reply

Anti-Spam Protection by WP-SpamFree