Home > Transact-SQL > Transact-SQL: Delete (drop) all user stored procedures from database

Transact-SQL: Delete (drop) all user stored procedures from database

19:32

Marek Śliwiński Leave a comment Print This Post  (394) Go to comments

Microsoft SQL Server 2005/2008

Run this code in your database context in SQL Management Studio:

SELECT
    'DROP PROCEDURE [' + name + ']'
as 'CopyThisColumnAndExecuteToDeleteAllProcedures'
FROM
    sys.procedures
WHERE
    [type] = 'P'
    AND is_ms_shipped = 0
    AND [name] NOT LIKE 'sp[_]%diagram%'
ORDER BY
    [name] ASC

drop_sp1

Copy generated statements and just run them to DELETE these stored procedures.
drop_sp2

foto_56388

Simply the best!

Same method you can use for tables or other objects.

Share and Enjoy:
  • DotNetKicks
  • Digg
  • del.icio.us
  • Wikio IT
  • Google Bookmarks
  • Facebook
  • Print
  1. No comments yet.
  1. No trackbacks yet.

Subscribe without commenting