开发者

Delete all procedures except those which contain a string in their name

开发者 https://www.devze.com 2022-12-15 18:34 出处:网络
I want to drop a lot of SPs fro开发者_如何学Gom my SQL Server database. However, I want to write \"Delete all procedures except those which contain a certain string in their name\".

I want to drop a lot of SPs fro开发者_如何学Gom my SQL Server database. However, I want to write "Delete all procedures except those which contain a certain string in their name".

How can I do this? I am using SQL Server 2008 R2.

Thank


What about:

SELECT 'DROP PROCEDURE ' + name
FROM    sysobjects WHERE xtype = 'U' AND
        name LIKE 'usp_%'   -- Here you'll define your criteria

After running this, you just need to execute this command output.

0

精彩评论

暂无评论...
验证码 换一张
取 消