如何查看Db上定义的所有触发器的列表?

时间:2011-06-08 14:50:18

标签: sql sql-server triggers

对于MS Sql,如何查看Db上定义的所有触发器的列表?

(我需要这个的原因是一个db表中的一列似乎被某些触发器修改)

谢谢!

2 个答案:

答案 0 :(得分:1)

在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

答案 1 :(得分:0)

来自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然后'禁用'ELSE'启用'END 来自sysobjects WHERE type ='TR'