Searching a string in SQL server 2005 -

It is very tedious to find out all Database objects (functions, stored procedures) containing a particular string.

Here is the script to get it-

DECLARE @Search varchar(255)

SET @Search='texttofind'

SELECT DISTINCT AS Object_Name,o.type_desc
FROM sys.sql_modules m
INNER JOIN sys.objects o ON m.object_id=o.object_id
WHERE m.definition Like '%'+@Search+'%' ORDER BY 2,1
This entry was posted in Knowledge Sharing, SQL Server, Troubleshooting. Bookmark the permalink.

4 Responses to Searching a string in SQL server 2005 -

  1. Anonymous says:

    I like this post, enjoyed this one thankyou for putting up.

  2. Thank you for sharing your issues on weblog. it’s most most likely that we have comparable interests. 1 factor are highly valuable to me.

  3. CruzHopkins says:

    Hi there! Do you use Twitter? Iâ??d like to follow you if that would be okay. Iâ??m definitely enjoying your blog and look forward to new posts.

  4. Thank you for the good writeup. It in fact was a leisure account it. Glance complicated to more delivered agreeable from you! However, how could we communicate?

Leave a Reply