To search a specific text in all store procedures and functions is common task. It can be achieved by following simple query.
SELECT sys.schemas.name +'.'+OBJECT_NAME(id)
SELECT sys.schemas.name +'.'+OBJECT_NAME(id)
FROM syscomments INNER JOIN sys.objects ON syscomments.id = sys.objects.object_id
INNER JOIN sys.schemas ON sys.objects.schema_id = sys.schemas.schema_id
WHERE [text] LIKE N'%YOUR TEXT HERE%'
AND (OBJECTPROPERTY(id, 'IsProcedure') = 1
OR OBJECTPROPERTY(id, 'IsScalarFunction') = 1
OR OBJECTPROPERTY(id, 'IsView') = 1)
GROUP BY sys.schemas.name +'.'+OBJECT_NAME(id)
No comments:
Post a Comment
All suggestions are welcome