Delete all stored procedures of a database using a query in sql server

11:52:00 pm 0 Comments

  • first generate the list of stored procedures to drop by inspecting the system catalog view:
     
    SELECT 'DROP PROCEDURE ' + p.NAME
    FROM sys.procedures p 
     
     This generates a list of DROP PROCEDURE statements in your SSMS output window.
  • copy that list into a new query window, and possibly adapt it / change it and then execute it
No messy and slow cursors, gives you the ability to check and double-check your list of procedure to be dropped before you actually drop it

0 comments: