IT Community - Software Programming, Web Development and Technical Support

How to delete all stored procedures in a Database

This is a discussion on How to delete all stored procedures in a Database within the Database Support forums, part of the Web Development category; Hi, I want to delete all stored procedures in a Database. Can anyone give me the query to do this?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-05-2008, 02:31 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default How to delete all stored procedures in a Database

Hi,

I want to delete all stored procedures in a Database. Can anyone give me the query to do this?
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-05-2008, 02:35 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 181
Balasubramanian.S is on a distinguished road
Default Re: How to delete all stored procedures in a Database

Hi,

This is the simple way to do this.

Use Database name

declare @procName varchar(500)

declare cur cursor

for Select [name] from sys.procedures where [type] = 'P' and is_ms_shipped = 0 and [name] not like 'sp[_]%diagram%'

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
__________________
S.Balasubramanian
Nothing is impossible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using arrays in stored procedures it.wily Database Support 2 02-09-2008 10:18 AM
SQL Server Undocumented Stored Procedures a.deeban Database Support 2 12-23-2007 11:20 PM
Using arrays in stored procedures oxygen Database Support 1 11-26-2007 08:01 AM
SQL Server Undocumented Stored Procedures a.deeban Database Support 3 09-04-2007 03:31 AM
Executing SQL Server Stored Procedures With PHP - Executing stored procedures Jeyaseelansarc PHP Programming 1 07-19-2007 12:23 AM


All times are GMT -7. The time now is 06:52 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0