How to drop all stored procedures at once in SQL Server database?

Posted by z-boss on Stack Overflow See other posts from Stack Overflow or by z-boss
Published on 2010-04-09T20:48:36Z Indexed on 2010/04/09 20:53 UTC
Read the original article Hit count: 406

Filed under:
|
|

Currently we use separate a drop statements for each stored procedure in the script file:

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MySP]')   
  AND type in (N'P', N'PC'))  
DROP PROCEDURE [dbo].[MySP] 

Is there a way to drop them all at once, or maybe in a loop?

© Stack Overflow or respective owner

Related posts about tsql

Related posts about SQLServer