Search through SQL Server Stored Procedures for code

Here’s a cool little script my boss showed me. If you want to find a snippet of code in a stored procedure, but you can’t remember the stored procedures name, use this query:

select as 'storProc'
  from sysobjects so
  join syscomments sc
  where so.type='P'
  and sc.[text] like '%BIT_YOU_WANT_TO_FIND%' 

Change the BIT_YOU_WANT_TO_FIND to whatever you want to search for.

Works a treat!

Subscribe via RSS

Back to all blog posts