简体   繁体   中英

Total count of stored procedures in Mysql database

How to get the total count of stored procedures in a MySQL database? Do I look in the information schema?

You can use this to see the list of Procedures

SELECT ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE="PROCEDURE" 
AND ROUTINE_SCHEMA="dbname";

You can find out more here

Try this solution, just replace your database name in the last line.

SELECT count(ROUTINE_NAME)procedure_count
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE="PROCEDURE" 
AND ROUTINE_SCHEMA="your database name";

This worked for me

SELECT     
    COUNT(*) as 'Stored Procedures'     
FROM SYS.OBJECTS
WHERE TYPE ='P'
GROUP BY TYPE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM