If this is a one- time task, just open Object Explorer, expand your database > programmability and highlight the Stored Procedures node. Then turn on Object Explorer Details. On the right you should see your list, and here you can multi-select – so you can sort by name, choose all procedures that start with aspnet_, and delete them all with one keystroke.
If you are doing this repeatedly, then (assuming your procedures are all in the dbo schema):
DECLARE @sql NVARCHAR(MAX) = N''; SELECT @sql += N'DROP PROCEDURE dbo.' + QUOTENAME(name) + '; ' FROM sys.procedures WHERE name LIKE N'aspnet[_]%' AND SCHEMA_NAME(schema_id) = N'dbo'; EXEC sp_executesql @sql;
You must log in to post a comment.