CREATE PROCEDURE [dbo].[DisableAllTriggers]AS
DECLARE @string VARCHAR(8000)DECLARE @tableName NVARCHAR(500)DECLARE cur CURSOR
FOR SELECT name AS tbname FROM sysobjects WHERE id IN(SELECT parent_objFROM sysobjects WHERE xtype='tr')OPEN curFETCH next FROM cur INTO @tableNameWHILE @@fetch_status = 0BEGIN
SET @string ='Alter table '+ @tableName + ' Disable trigger all'EXEC (@string)FETCH next FROM cur INTO @tableNameEND
CLOSE curDEALLOCATE cur
GO----To execute the SP
EXEC [DisableAllTriggers]
No comments:
Post a Comment