Introduction :
In this article we will learn how to delete all the user defined Stored Procedures from
your Sql Server database.
We can delete all Stored Procedure by executing single query. We don’t need to execute different query for each Procedure.
Note: This command will delete all the stored procedures from your database so use with care.
We can delete all Stored Procedure by executing single query. We don’t need to execute different query for each Procedure.
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 @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
0 comments:
Post a Comment