Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find a text inside SQL Server code

T-SQL Hints and Tips

How to find a text inside SQL Server code

by  arturm  Posted    (Edited  )
Create the procedure (SQL Server 2012):

[code SQL]CREATE PROCEDURE sp_FindText @p_text varchar(100)
AS
SELECT DISTINCT name, type
FROM sys.sysobjects so WITH (NOLOCK)
INNER JOIN sys.syscomments sc WITH (NOLOCK)
ON so.id = sc.id
WHERE text LIKE '%' + @p_text + '%'
ORDER BY name[/code]

Now, you can use sp_FindText to finding text inside procedures, functions, triggers, views etc:

[code SQL]sp_FindText 'my_text';[/code]

Use this procedure, you can watch here:
[link http://www.learn-with-video-tutorials.com/how-to-find-a-text-inside-sql-server-code]http://www.learn-with-video-tutorials.com/how-to-find-a-text-inside-sql-server-code[/link]
or here:
[link http://www.youtube.com/watch?v=EXFgC8SBbdI]http://www.youtube.com/watch?v=EXFgC8SBbdI[/link]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top