Thursday, November 26, 2009

Get all triggers in a database

Applied to SQL Server 2005 or later


SELECT t1.name [Trigger Name],
t3.name [Table Owner],
t2.name [Table Name],
CASE WHEN t1.is_disabled = 0 THEN 'Enabled'
ELSE 'Disabled'END Status
FROM sys.triggers t1
INNER JOIN sys.tables t2
ON
t1.parent_id = t2.object_id
INNER JOIN sys.schemas t3
ON t2.schema_id = t3.schema_id

No comments:

Post a Comment