Created
April 9, 2017 20:33
-
-
Save alex-titarenko/2f327f5b65181c5a146bfd5c0e924b0e to your computer and use it in GitHub Desktop.
How do I find a stored procedure containing <text>? (MSSQL)
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
SELECT ROUTINE_NAME, ROUTINE_DEFINITION | |
FROM INFORMATION_SCHEMA.ROUTINES | |
WHERE ROUTINE_DEFINITION LIKE '%Foo%' | |
AND ROUTINE_TYPE='PROCEDURE' | |
SELECT OBJECT_NAME(id) | |
FROM SYSCOMMENTS | |
WHERE [text] LIKE '%Foo%' | |
AND OBJECTPROPERTY(id, 'IsProcedure') = 1 | |
GROUP BY OBJECT_NAME(id) | |
SELECT OBJECT_NAME(object_id) | |
FROM sys.sql_modules | |
WHERE OBJECTPROPERTY(object_id, 'IsProcedure') = 1 | |
AND definition LIKE '%Foo%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment