SELECT DISTINCT
Tables.Name TableName
, Triggers.name TriggerName
, Triggers.crdate TriggerCreatedDate
, [Type] = CASE WHEN Triggers.xtype = 'TR' THEN 'SQL Trigger'
ELSE 'CLR Trigger'
END
, [Disabled] = OBJECTPROPERTY(OBJECT_ID(Triggers.name), 'ExecIsTriggerDisabled')
FROM
sysobjects Triggers
INNER JOIN sysobjects Tables
ON Triggers.parent_obj = Tables.id
AND Tables.xtype = 'U'
AND Tables.name = 'eperson'
LEFT JOIN syscomments Comments
ON Triggers.id = Comments.id
WHERE
Triggers.xtype IN ( 'TR', 'TA' )
ORDER BY
Tables.Name
, Triggers.name
Updated the above query to handle CLR triggers and to show if the trigger is disabled.
No comments:
Post a Comment