November 11, 2011

Find a word inside stored procedure

We can search any word inside all stored procedures of a database.
T-SQL
SELECT ROUTINE_NAME AS 'Stored Procedure'
,ROUTINE_DEFINITION AS 'Stored Procedure Content'
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%UserInfo%'
AND ROUTINE_TYPE='PROCEDURE'
ORDER BY ROUTINE_NAME ASC

Output will look like as below.

image


That’s It.
Enjoy Learning.

No comments:

Post a Comment