我想从我的MySQL数据库中删除所有的存储过程。我应该如何编写查询语句?
试试这个
USE sbnmaster;
SELECT CONCAT('DROP PROCEDURE IF EXISTS ', SPECIFIC_NAME, ';') AS StorePrecedure
FROM information_schema.ROUTINES R
WHERE R.ROUTINE_TYPE = 'PROCEDURE'
AND R.ROUTINE_SCHEMA = DATABASE();
SELECT CONCAT("DROP PROCEDURE IF EXISTS ",SPECIFIC_NAME,";") AS StorePrecedure
。 - BenR我不确定它是否正确,但似乎它能够工作 -
DELETE FROM mysql.proc WHERE db = 'sbnmaster' AND type = 'PROCEDURE';