Searching for Text in a SQL Stored Procedure
I always write a blog article on things that took me a little to time to find when I working on various projects.
I’m working a project with another developer and they had sent me a screenshot of a SQL stored procedure that I needed to look at but they didn’t tell me the name of the file.
I needed to take some text from the screenshot and figure out which stored procedure it was in out of 100 or more.
Below is an example of the SQL script I used to find the text I was looking for. You’ll be searching the definition for you specific text.
SQL Script Example:
Find Text in Stored Procedures
SELECT DISTINCT o.name AS Object_Name, o.type_desc, m.definition FROM sys.sql_modules m INNER JOIN sys.objects o ON m.object_id = o.object_id WHERE m.definition Like '%@RowString%';
I hope this help you solve your issue!