Monday, May 6, 2019

how to disable and enable the triggers in SQL to increase the SQL execution time

//Disable
Declare @SQLTrigger varchar(max)
 set @SQLTrigger=  'dbo.sp_MSforeachtable @command1='+'"'+'DISABLE TRIGGER ALL ON ?'+'" '
 exec(@SQLTrigger)


//Enable
 Declare @SQLTrigger varchar(max)
 set @SQLTrigger=  'dbo.sp_MSforeachtable @command1='+'"'+'Enable TRIGGER ALL ON ?'+'" '
 exec(@SQLTrigger)

No comments:

Post a Comment