Introduction:
In this
article i will explain how to delete all the triggers from Sql
Server database. If we want to delete all triggers from our database, then
we can done it by using single query.
Note: This
command will delete all the triggers from your database so use this command
with care.
Implementation: In Sql server execute the
following command:
Declare @trgName
varchar(500)
Declare cur Cursor For Select [name] From sys.objects
where type = 'tr'
Open cur
Fetch Next From cur Into @trgName
While @@fetch_status = 0
Begin
Exec('drop trigger ' + @trgName)
Fetch Next From cur Into @trgName
End
Close cur
Deallocate cur