[转] sqlserver 中查看trigger的disabled/enabled情况
本文转自:http://blog.csdn.net/miqi770/article/details/48708199
SELECT t.name AS TableName, tr.name AS TriggerName, CASE WHEN 1=OBJECTPROPERTY(tr.id, 'ExecIsTriggerDisabled') THEN 'Disabled' ELSE 'Enabled' END Status FROM sysobjects t INNER JOIN sysobjects tr ON t.id = tr.parent_obj WHERE ( t.xtype = 'U' OR t.XType = 'V') AND ( tr.xtype = 'TR') ORDER BY t.name, tr.name
--启用
alter table TableName enable trigger TriggerName--禁用
alter table TableName disable trigger TriggerName
查看当前库中所有的触发器
本文转自:http://www.cnblogs.com/davidhou/p/5846914.html
--查看当前库中所有的触发器:
SELECT * FROM Sysobjects WHERE xtype = 'TR'
--查看当前库中所有的触发器和与之相对应的表:
SELECT tb2.name AS tableName,tb1.name AS triggerName FROM Sysobjects tb1 JOIN Sysobjects tb2 ON tb1.parent_obj=tb2.id WHERE tb1.type='TR'
--显示触发器的定义:
EXEC sp_helptext '触发器名'
--查看触发器的有关信息:
EXEC sp_help '触发器名'
--查看表中的触发器类型:
EXEC sp_helptrigger '表名'
posted on 2017-08-17 09:05 freeliver54 阅读(480) 评论(1) 编辑 收藏 举报