-- Find routine with text (wraps 4000 N)
-- http://www.sqltact.com/2012/04/syssqlmodules-vs-informationschemarouti.html
DECLARE @searchString NVARCHAR (4000) = ''
SET @searchString = 'product'
SELECT s.name
+ '.'
+ o.name
, o.type_desc
, m.[definition]
FROM sys.sql_modules m
JOIN sys.objects o
ON m.object_id = o.object_id
JOIN sys.schemas s
ON s.schema_id = o.schema_id
WHERE m.[definition] like '%' + @searchString + '%'
ORDER BY o.name
No comments:
Post a Comment