In so many case we need to delete the store procedure objects which are created on database, to handle this Tedious job we can go with the just one script execution and job done !!!!
Step 1
Use the Database whichever you want to delete the store procedure
Step 2
Run the below script
DECLARE @procedureName varchar(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'p'
OPEN cur
FETCH NEXT FROM cur INTO @procedureName
WHILE @@fetch_status = 0
BEGIN
EXEC('DROP PROCEDURE ' + @procedureName)
FETCH NEXT FROM cur INTO @procedureName
END
CLOSE cur
DEALLOCATE cur
Note :- Take a back up script file before execution of above script
Happy Programming
Comments