Finding All Triggers in SQL Server
Database triggers are sometimes difficult to track down. I needed to locate a list of all of the triggers in a database to check them for performance issues, and, when I turned to the INFORMATION_SCHEMA views, discovered there is not one for triggers. Oh well, back to interrogating the system tables.
Triggers are located in the sys.triggers table, so the following query delivered the information I needed:
SELECT
o.name AS parent_object,
t.name AS trigger_name,
c.text AS trigger_def
FROM sys.sysobjects o
INNER JOIN sys.triggers t
ON t.parent_id = o.id
INNER JOIN sys.syscomments c
ON c.id = t.object_id
o.name AS parent_object,
t.name AS trigger_name,
c.text AS trigger_def
FROM sys.sysobjects o
INNER JOIN sys.triggers t
ON t.parent_id = o.id
INNER JOIN sys.syscomments c
ON c.id = t.object_id
Comments
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]