snippetsqlMinor
How can I search the full text of a stored procedure for a value?
Viewed 0 times
storedcanfullthesearchtextvalueprocedureforhow
Problem
I use the following script to search the text of all stored procedures when I want to find specific values.
I recently discovered that
How can I query the full text of a stored procedure for a value?
SELECT ROUTINE_NAME, ROUTINE_TYPE
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE @searchText
ORDER BY ROUTINE_NAMEI recently discovered that
ROUTINE_DEFINITION stops after 4000 characters, so some procedures were not getting returned when they should have been.How can I query the full text of a stored procedure for a value?
Solution
Use one of
Never use
- sys.sql_modules
- Red Gate SQL Search (free!)
- OBJECT_DEFINITION
Never use
- INFORMATION_SCHEMA
- sys.syscomments
Context
StackExchange Database Administrators Q#41765, answer score: 7
Revisions (0)
No revisions yet.