Find Status of all Database Triggers

Posted: May 15, 2011 in SQL Server 2005

To find the statu of all triggers in the database, run the following script:

SELECT   t.name  table_name,
	     tr.name trigger_name,
	     CASE
	        WHEN OBJECTPROPERTY(tr.id, 'ExecIsTriggerDisabled') = 1 THEN 'Disabled'
	        WHEN OBJECTPROPERTY(tr.id, 'ExecIsTriggerDisabled') = 0 THEN 'Enabled'
	        ELSE 'ERROR'
	     END trigger_status
FROM     sysobjects            t
         INNER JOIN sysobjects tr  ON tr.parent_obj = t.id
                                  AND tr.xtype      = 'TR'
WHERE    t.xtype = 'U'
ORDER BY t.name,
         tr.name;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s