SQL Server: Search string / text in all stored procedures of a database

Here we are searching text named date_of_inv which is a column Name as well.
SELECT * FROM
SYS.PROCEDURES
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%DATE_OF_INV%'

Here we are searching string LocID which is just a string and not the column name.
SELECT * FROM
SYS.PROCEDURES
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%LOCID%'

The above two queries is specific to a database and will not search all the databases.

No comments:

Post a Comment