SQL Journey

Journey of SQL Server & Microsoft Business Intelligence

SQL Server – Search Text in Stored Procedure

Posted by Prashant on February 8, 2013

Here is the query to search text in stored procedure definition:

 SET @SearchText = 'Hierarchy'
 o.name AS [Object Name],
 o.type_desc AS [Object Type],
 m.definition AS [Definition],
FROM sys.sql_modules m
INNER JOIN sys.objects
 o ON m.object_id=o.object_id
WHERE m.definition LIKE '%' + @SearchText + '%'
 AND o.name LIKE 'usp_%'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: