Search text in SP

*Just as a note to myself*

I’ve just joined a big project with thousands of stored procedures. To get an overview of it, it would be nice if I could get the SP’s which inserted data in to table a, or update column b in table c etc.

That is easily done, like so:

SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE ‘%table a%’

and

SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE ‘%column b%’
AND OBJECT_DEFINITION(OBJECT_ID) LIKE ‘%table c %’

Leave a Reply

Your email address will not be published. Required fields are marked *