Please disable your adblock and script blockers to view this page
 

How to delete all triggers from sql server database

Introduction: In this article i will explain how to delete all the triggers from Sql Server database.

Description: In previous articles i explained How to delete all stored procedures from sql server database and How to delete all views from sql server database and How to delete all tables from Sql server Database .Now i am going to share the command that will delete all the triggers created in the Sql server Database.
Note: This command will delete all the triggers from your database so use 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


Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily.. ConversionConversion EmoticonEmoticon