Home > SQL, SQL 2005, SQL 2008 > SQL List All Triggers In Database

SQL List All Triggers In Database

Query which returns all Triggers in a database

USE YourDBName
GO
SELECT trigger_name = sysobjects.name, 
      trigger_owner = 'x',
      table_schema = s.name,
      table_name = OBJECT_NAME(parent_obj),
      isupdate = OBJECTPROPERTY( id, 'ExecIsUpdateTrigger'), 
      isdelete = OBJECTPROPERTY( id, 'ExecIsDeleteTrigger'),
      isinsert = OBJECTPROPERTY( id, 'ExecIsInsertTrigger'), 
      isafter = OBJECTPROPERTY( id, 'ExecIsAfterTrigger'),
      isinsteadof = OBJECTPROPERTY( id, 'ExecIsInsteadOfTrigger'),
      [disabled] = OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') 
   FROM sysobjects
   INNER JOIN sys.tables t ON sysobjects.parent_obj = t.object_id
   INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
   WHERE sysobjects.type = 'TR'
Advertisements
Categories: SQL, SQL 2005, SQL 2008
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: