当前位置:Gxlcms > 数据库问题 > [转] sqlserver 中查看trigger的disabled/enabled情况

[转] sqlserver 中查看trigger的disabled/enabled情况

时间:2021-07-01 10:21:17 帮助过:17人阅读

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 enable 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 ‘表名‘

 

[转] sqlserver 中查看trigger的disabled/enabled情况

标签:tar   blog   and   log   enabled   情况   code   trigger   sqlserver   

人气教程排行