Posted By

lance on 08/05/10


Tagged

sql search


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

hchattaway
Tyster
derebus
johnw


Find Stored Procedures with specified name or contains specified text


 / Published in: SQL
 

  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  

You need to login to post a comment.