Saturday, August 14, 2010

Display all Stored Procedures containing a particular string in MS SQL

 
Use below query to display the complete list of Stored Procedures in the database containing a particular string.

SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_DEFINITION LIKE '%User_ID%' AND ROUTINE_TYPE='PROCEDURE'

Out put of the above query will be the list of Stored Procedures containing the string "User_ID" in your database.

No comments: