Need the Ability be able to search DB Objects for Text

  • I am looking to see if anyone has a way to search database objects for certain text. If "ServerA" is in the guts of a SPROC and/or FUNCTION, I would like to know which ones.

    As always thanks for the Help...

  • Have a look at the sys.sql_modules(http://msdn.microsoft.com/en-us/library/ms175081.aspx) system view. The definition column should have the data you are looking for.

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

  • Thanks Bob, that works. If anyone else has a different way to do this, I would like to see it.

  • This finds a string in functions, views, and stored procedures.

    select distinct o.name, o.type_desc from sys.objects o

    where OBJECT_DEFINITION(o.object_id) like '%searchstring%'

    order by o.name

    Greg

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

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