Find Stored Procedures with specified name or contains specified text


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



Copy this code and paste it in your HTML
  1. --needs to be run in the database that you want to search in
  2. --get all procedures with name like
  3. SELECT DISTINCT SO.Name
  4. FROM sysobjects SO (NOLOCK)
  5. WHERE SO.Type = 'P'
  6. AND SO.Name LIKE '%report%'
  7. ORDER BY SO.Name
  8.  
  9.  
  10. --get all procedures containing text like
  11. SELECT DISTINCT SO.Name
  12. FROM sysobjects SO (NOLOCK)
  13. INNER JOIN syscomments SC (NOLOCK) ON SO.Id = SC.ID
  14. AND SO.Type = 'P'
  15. AND SC.Text LIKE '%report%'
  16. ORDER BY SO.Name

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.