Created
October 8, 2015 18:10
Search for a specific string inside a SQL stored procedure object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @find VARCHAR(1000) | |
SET @find = '%search string%' | |
SELECT | |
sp.name, | |
ISNULL(smsp.definition, ssmsp.definition) AS [Definition] | |
FROM | |
sys.all_objects AS sp | |
LEFT OUTER JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id | |
LEFT OUTER JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id | |
WHERE | |
(sp.type = N'P' OR sp.type = N'RF' OR sp.type='PC') | |
AND ISNULL(smsp.definition, ssmsp.definition) LIKE '%' + @find + '%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment