Export a result set as an SQL dump

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Export a result set as an SQL dump

Post by batfastad »

Hi everyone

I need to delete some data from a database, but it's only selected data.
We need to re-enter a selection of orders into our order system because they were done incorrectly.

I have the query which returns the data, and I was planning to just delete all those rows within phpMyAdmin.

I've backed up the data to an Excel file, and taken numerous dumps of the whole table.

But I was wondering if anyone knows of a script or program that can give me an SQL dump of only the result set, not the entire table?
Then if something goes wrong, I can just paste the SQL dump into the SQL window of phpMyAdmin to restore those rows of data.


I use phpMyAdmin and the MySQL Query Browser and neither have the option to export a result set as SQL... only CSV, Excel, PDF report, PLIST etc.

Does anyone know of a PHP script or utility that will let me do this?
I don't have the time to write a PHP script myself.

Thanks
Ben
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

Try working with a GUI to do this. A really good one is EMS SQL Manager 2007 for MySQL. You can get a free 30 day trial. It will let you export any result set as SQL, import directly from excel, mow your lawn, make you dinner etc. etc.
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Post by batfastad »

Wow what an excellent bit of software! :lol:
Thanks for the suggestion, got it sorted!!
Post Reply