use DB_NAME
SELECT DISTINCT
DB_NAME() AS DatabaseName,
OBJECT_SCHEMA_NAME(id) AS SchemaName,
OBJECT_NAME(id) AS ObjectName,
SUBSTRING(text, PATINDEX('%YOUR_SEARCH_TEXT%',text) - 10, 100) AS TextLocation
FROM sys.syscomments
WHERE text LIKE '%YOUR_SEARCH_TEXT%'
ORDER BY 1, 2, 3
No comments:
Post a Comment