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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With