How to get listing of stored procedures for SQL server database

Just a quick note on how to get listing of stored procedures for SQL server database. Following query will do this for you (as long as you’re not in the master database, system stored procedures won’t be returned):

\n\n

SELECT *\nFROM DatabaseName.information_schema.routinesWHERE routine_type = ‘PROCEDURE’

You may add AND specific_name LIKE ‘%part_of_specific_name%’ to WHERE clause to filter/look up for specific stored procedure by name.

If for some reason you had non-system stored procedures in the master database, you could use the query (this will filter out MOST system stored procedures):

\n\n

SELECT *\nFROM master.information_schema.routinesWHERE routine_type = ‘PROCEDURE’\nAND Left(Routine_Name, 3) NOT IN (‘sp_’, ‘xp_’, ‘ms_’)

\nSource – question on stackowerflow.com: Query that returns list of all Stored Procedures in an MS SQL database.

Leave a Reply

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