Drop store procedures by name contains


/ Published in: SQL
Save to your folder(s)

Drop store procedures


Copy this code and paste it in your HTML
  1. DECLARE @procName VARCHAR(500)
  2. DECLARE cur cursor
  3.  
  4. FOR SELECT [name] FROM sys.objects WHERE TYPE = 'p' AND name LIKE '%sp_%'
  5. OPEN cur
  6. fetch NEXT FROM cur INTO @procName
  7. while @@fetch_status = 0
  8. BEGIN
  9. EXEC('drop procedure ' + @procName)
  10. fetch NEXT FROM cur INTO @procName
  11. END
  12. close cur
  13. deallocate cur

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.