Created
April 16, 2013 21:22
-
-
Save kad1r/5399758 to your computer and use it in GitHub Desktop.
Drop all stored procedures in 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
-- first drop function | |
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 | |
-- second drop function | |
-- this function generates list of DROP PROCEDURE statements | |
-- copy the results, open new query then paste and run. | |
SELECT 'DROP PROCEDURE ' + p.NAME | |
FROM sys.procedures p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment