declare @IDList as varchar(8000)
declare @ID as int
declare @i as int
declare @sql varchar(500)
declare @tableName varchar(500)
declare @trigger varchar(500)
set @tableName=''
set @trigger=''
set @IDList=''
select @IDList=@IDList+cast(ID as varchar(500))+',' from sysobjects bbbb where type='tr' order by ID
if len(@IDList)=0
return
while CharIndex(',',@IDList)<>0
Begin
set @ID = SubString(@IDList,1,CharIndex(',',@IDList)-1)
set @IDList = Replace(','+@IDList,','+Cast(@ID as nvarchar(50))+',','')
--select @ID
select @trigger=name,@tableName=(select [name] from sysobjects eee where eee.id=bbbb.parent_obj) from sysobjects bbbb where type='tr' and id=@ID
--如果要启用,disable改成enable
set @sql = 'alter table '+ @tableName +' disable trigger ' + @trigger
exec(@sql)
--print(@sql)
declare @ID as int
declare @i as int
declare @sql varchar(500)
declare @tableName varchar(500)
declare @trigger varchar(500)
set @tableName=''
set @trigger=''
set @IDList=''
select @IDList=@IDList+cast(ID as varchar(500))+',' from sysobjects bbbb where type='tr' order by ID
if len(@IDList)=0
return
while CharIndex(',',@IDList)<>0
Begin
set @ID = SubString(@IDList,1,CharIndex(',',@IDList)-1)
set @IDList = Replace(','+@IDList,','+Cast(@ID as nvarchar(50))+',','')
--select @ID
select @trigger=name,@tableName=(select [name] from sysobjects eee where eee.id=bbbb.parent_obj) from sysobjects bbbb where type='tr' and id=@ID
--如果要启用,disable改成enable
set @sql = 'alter table '+ @tableName +' disable trigger ' + @trigger
exec(@sql)
--print(@sql)