GUNAKAN [ Database]
PERGI
DECLARE @TriggerName AS VARCHAR(500)
-- Jatuhkan atau Hapus Semua Pemicu dalam Database di SQL Server
DECLARE DropTrigger CURSOR FOR
SELECT TRG .name AS TriggerName
FROM sys.triggers TRG
INNER JOIN sys.tables TBL
ON TBL.OBJECT_ID =TRG.parent_id
OPEN DropTrigger
FETCH Next FROM DropTrigger INTO @TriggerName
SELAMA @@FETCH_STATUS =0
BEGIN
MENYATAKAN @SQL VARCHAR(MAX)=NULL
SET @SQL='Drop Trigger ' + @TriggerName
PRINT 'Pemicu ::' + @TriggerName
+ ' Berhasil Dijatuhkan'
EXEC (@SQL)
PRINT @SQL
FETCH Next FROM DropTrigger INTO @TriggerName
END
TUTUP DropTrigger
DEALOKASI DropTrigger