开发者

How can I see the list of all the triggers defined on a Db?

开发者 https://www.devze.com 2023-03-11 02:15 出处:网络
For MS Sql, how can I see the list of all the triggers defined on a Db? (开发者_JS百科The reason I need this is one of the columns in one db table seems to be modified by some trigger(s) )

For MS Sql, how can I see the list of all the triggers defined on a Db?

(开发者_JS百科The reason I need this is one of the columns in one db table seems to be modified by some trigger(s) )

Thanks!


In MSSql:

select B.Name as TableName,A.name as TriggerName
from sysobjects A,sysobjects B
where A.xtype='TR'
AND A.parent_obj = B.id


from http://weblogs.sqlteam.com/davidm/archive/2004/02/27/999.aspx

SELECT trigger_name = name, trigger_owner = USER_NAME(uid), 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'), status = CASE OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') WHEN 1 THEN 'Disabled' ELSE 'Enabled' END FROM sysobjects WHERE type = 'TR'

0

精彩评论

暂无评论...
验证码 换一张
取 消