开发者

How to delete all procedures of a database in mysql5

I want to delete all procedures from my MySQL database 开发者_开发百科sbnmaster. How should I write a query for this?


Try this

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(); 


Not sure that it is correct, but seems it works -

DELETE FROM mysql.proc WHERE db = 'sbnmaster' AND type = 'PROCEDURE';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜