Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Dropping procs that start with some characters

Author  Topic 

MangoSkin
Starting Member

22 Posts

Posted - 2011-06-16 : 11:06:17
Hi,
Is there a way I could drop all storedprocedures from my database that start with a pattern "XX_".
Please Advice.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-16 : 11:57:53
From an SSMS query window, run this query in your database, copy the output of the query to a qeruy window (verify that that is what you want to do) and run it.

SELECT 'drop procedure ' + name FROM sys.procedures WHERE NAME LIKE 'XX_%'
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-16 : 12:17:42
I hope it is not too late and you have not destroyed your database, but change that query to

SELECT 'drop procedure ' + name FROM sys.procedures WHERE NAME LIKE 'XX[_]%'
Go to Top of Page
   

- Advertisement -