How to delete all stored procedures from sql server database

Introduction In this article i will explain how to delete all the user defined Stored Procedures from your Sql Server database.

Description: In previous articles i explained How to delete all tables from Sql server Database and How to delete all views from sql server database and  How to delete all triggers from sql server database . Now i am going to share the command to delete all the created stored procedure from the Sql Server database.

Note: This command will delete all the stored procedures from your database so use with care.

Implementation: In Sql Server execute the following command:


Declare @procName varchar(500)
Declare cur Cursor For Select [name] From sys.objects where type = 'p'
Open cur
Fetch Next From cur Into @procName
While @@fetch_status = 0
Begin
 Exec('drop procedure ' + @procName)
 Fetch Next From cur Into @procName
End
Close cur
Deallocate cur 



Previous
Next Post »

1 comments:

Click here for comments
July 24, 2013 ×

your welcome saliman. Subscribe and stay tuned for more updates

Congrats bro Lalit Raghuvanshi you got PERTAMAX...! hehehehe...
Reply
avatar

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..