Search

Tuesday, October 25, 2011

Disabled Triggers List

If you have triggers running against your database tables then you probably want to make sure they are turned on or off at the right times. Here's a script to check the status of your triggers.


SELECT db_name() AS [Database Name],
T.[name] AS [Table Name],
TR.[Name] AS [Trigger Name],
[Status] = CASE WHEN OBJECTPROPERTY(TR.[id], 'ExecIsTriggerDisabled') = 1
THEN 'Disabled' ELSE 'Enabled' END
FROM sysobjects T
JOIN sysobjects TR ON t.[ID] = TR.[parent_obj]
WHERE T.[xtype] = 'U'
AND TR.[xtype] = 'TR'

No comments:

Post a Comment