Search Stored Procedure Code

  • I need to be able to find/search for all instances of a string in all stored procedure code for a particular database. Is this possible?

  • Yes there is.  I had the opportunity to acquire this script from sqlservercentral last year.  Hope you too can benefit by it.

    ALTER procedure sp_FindText @SearchText varchar(100) 

    AS

    /*

    Acknowledgement: Okie_Greg

    Source: www.sqlservercentral.com/forums

    Location: http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=102649&p=2

    Date: 21-Apr-04

    */

    SELECT sysobjects.name AS 'Stored Procedure'

    FROM sysobjects,syscomments

    WHERE sysobjects.id = syscomments.id

    AND 

    sysobjects.type = 'P'

    AND 

    sysobjects.category=0

    AND

    charindex(@SearchText,syscomments.text)>0

    RETURN

  • sql digger

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=112&messageid=171871

    it's easy to use and highlights your search phrase

  • Thanks SRB and scking. You have been a great help. That SQL Digger Application is sweet!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply