Created
November 29, 2014 19:48
-
-
Save MagicAndi/cc8e80ddf05f2cdd52e4 to your computer and use it in GitHub Desktop.
A SQL script to delete all stored procedures in a SQL database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DeleteProcCommand NVARCHAR(500) | |
DECLARE Syntax_Cursor CURSOR | |
FOR | |
SELECT 'DROP PROCEDURE ' + p.NAME | |
FROM sys.procedures p | |
OPEN Syntax_Cursor | |
FETCH NEXT FROM Syntax_Cursor | |
INTO @DeleteProcCommand | |
WHILE (@@FETCH_STATUS = 0) | |
BEGIN | |
EXEC (@DeleteProcCommand) | |
FETCH NEXT FROM Syntax_Cursor | |
INTO @DeleteProcCommand | |
END | |
CLOSE Syntax_Cursor | |
DEALLOCATE Syntax_Cursor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment