Am I right in thinking that all procedures start with CREATE PROCEDURE and end with ; ? If you do an SQL dump, you get the SQL for the entire database in a plain text file. You can easily scan it for its text, and it shouldn't be hard to create a regular expression to find procedures. Finding the end of a procedure might be more awkward because you might have DELIMITER instructions so there are ; in the text. You might also have ; inside 'strings' with 'quote marks' like this: 'Campbell Ritchie should never be trusted; he makes mistakes all the time.' You can probably permit quotes and DELIMITER instructions in your regular expression. You never know, there might be one ready-made somewhere. If you are looking for one, try here.

James.HD Li
Greenhorn

Joined: May 11, 2009
Posts: 10

posted Mar 31, 2010 10:05:34

0

Peter, thanks for take this topic to a better place.

Campbell, thank you so much. This is quite a professional way and should be smart enough to resolve this problem.

But I just wander if there is a simple way like a command line that just dump all the procedures?

J

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41065

29

posted Apr 01, 2010 03:06:33

0

You're welcome. try the MySQL manual; if you find "mysqldump" in the index (here for MySQL5.0) or look for newer versions, there appears to be a routines option which you may find very helpful.

James.HD Li
Greenhorn

Joined: May 11, 2009
Posts: 10

posted Apr 01, 2010 08:35:14

0

I think I have too name a table after the database name and manually delete that 'create table script'
Thanks a lot for you reply.