Find a text in a Store Procedure or Function

Posted by Niladri.biswas under Sql Server category on | Points: 40 | Views : 1652
The below code will help us to find out a text in a store procedure/function in a particular database

DECLARE @TextToFind VARCHAR(100) = 'myTable'

[Object Name] = o.Name

,[Object Type] = o.Type_Desc

,[Content In Text Mode] = c.Text

,[Creation Date] = o.Create_Date

,[Last Modification Date] = o.Modify_Date

FROM Sys.Objects o
JOIN SysComments c
ON o.object_id =
WHERE o.[Type] IN ('FN','TF','P')
AND c.Text LIKE '%' +@TextToFind + '%'
ORDER BY o.[Type]

Hope this will be helpful

Comments or Responses

Login to post response