测试环境SQL Server 2012 select a.definition , b.name,b.is_disabled from sys.sql_modules a inner join sys.triggers b on a.object_id=b.object_id --所有的触发器 select b.name as TableName,a.name as TriggerName from sys.triggers a inner join sys.all_objects b on a.parent_id=b.object_id where a.is_disabled=1 --停用的触发器 alter table 自己的表名 disable trigger 触发器名字 --停用触发器语句 --先创建所有触发器,然后停用触发器 USE 数据库 GO --这个SQL 语句就好了 select definition +char(13)+char(10)+'GO'+(case is_disabled when 1 then char(13)+char(10)+'ALTER TABLE '+c.name+' DISABLE TRIGGER '+b.name+char(13)+char(10)+'GO' else'' end), b.name,b.is_disabled from sys.sql_modules a inner join sys.triggers b on a.object_id=b.object_id --所有的触发器 inner join sys.all_objects c on b.parent_id=c.object_id
标签:char,触发器,name,object,Server,sys,SQL,id From: https://www.cnblogs.com/dmqhjp/p/16737797.html