Technical Article

Search all stored procedures on all databases

,

Just replace %foobar% with any keyword and run.  The MSForEachDB will cycle through every database on the instance and search every stored procedure for you. 

You can change the Routine_Type to be VIEW as well and it will search all views!

EXEC sp_MSForEachDB 

 'USE ?; 
SELECT DB_NAME(), ROUTINE_NAME 
    FROM INFORMATION_SCHEMA.ROUTINES 
    WHERE ROUTINE_DEFINITION LIKE ''%foobar%''
    AND ROUTINE_TYPE = ''PROCEDURE'''

Rate

3.4 (5)

You rated this post out of 5. Change rating

Share

Share

Rate

3.4 (5)

You rated this post out of 5. Change rating