Search procedures for string values
Need to search for certain text in procedures but don't want to do it manually? Found a nice query that will search for a string in a database's procedures and will let you know which procedures contain it.
Code:
use [DATABASENAMEHERE]
GO
SELECT sm.object_id, OBJECT_NAME(sm.object_id) AS object_name, o.type, o.type_desc, sm.definition
FROM sys.sql_modules AS sm
JOIN sys.objects AS o ON sm.object_id = o.object_id
where sm.definition like '%SEARCH_WORD_HERE%' collate SQL_Latin1_General_CP1_CI_AS
ORDER BY o.type;
GO
*RED need to be edited!
Re: Search procedures for string values