8 个解决方案
#1
查了一下好象一次只能删除一个Drop Trigger triggerName
#2
禁用某个表的所有触发器:
alter table 表名 disable trigger all
alter table 表名 disable trigger all
#3
可能需要写个存储过程,然后用游标和循环,不会写
关注
关注
#4
以下是删除一个数据库中所有的触发器
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR')
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR'
EXEC(@STRING)
END
GO
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR')
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR'
EXEC(@STRING)
END
GO
#5
噢,楼主的意思是删除一个表的所有触发器
那么,稍微修改一下即可
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表)
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表
EXEC(@STRING)
END
GO
那么,稍微修改一下即可
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表)
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表
EXEC(@STRING)
END
GO
#6
楼上的有点道理!
#7
收藏~
#8
USE YOUR_DB
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' AND NAME = 'TABLE_NAME'
如果有数据
DROP TRIGGER ...
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' AND NAME = 'TABLE_NAME'
如果有数据
DROP TRIGGER ...
#1
查了一下好象一次只能删除一个Drop Trigger triggerName
#2
禁用某个表的所有触发器:
alter table 表名 disable trigger all
alter table 表名 disable trigger all
#3
可能需要写个存储过程,然后用游标和循环,不会写
关注
关注
#4
以下是删除一个数据库中所有的触发器
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR')
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR'
EXEC(@STRING)
END
GO
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR')
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR'
EXEC(@STRING)
END
GO
#5
噢,楼主的意思是删除一个表的所有触发器
那么,稍微修改一下即可
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表)
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表
EXEC(@STRING)
END
GO
那么,稍微修改一下即可
--触发器
DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表)
BEGIN
SELECT @STRING='DROP TRIGGER '+NAME+ CHAR(13) FROM SYSOBJECTS WHERE XTYPE='TR' and name=你的表
EXEC(@STRING)
END
GO
#6
楼上的有点道理!
#7
收藏~
#8
USE YOUR_DB
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' AND NAME = 'TABLE_NAME'
如果有数据
DROP TRIGGER ...
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='TR' AND NAME = 'TABLE_NAME'
如果有数据
DROP TRIGGER ...