Posted By

ironcrema on 04/05/14


Tagged

sql server drop procedures


Versions (?)

Drop store procedures by name contains


 / Published in: SQL
 

Drop store procedures

  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  

You need to login to post a comment.