[Bug] Data only SQL export of tables in multiple databases does not have use statements

[expired user #8536]'s profile image [expired user #8536] posted 9 years ago in Import/Export Permalink
Looks like when exporting table data only across multiple databses that the resulting file does not have "Use Database" directive.

How to reproduce:
Tools / Export Database as SQL to open Table Tools dialog
uncheck all checkboxes (DB Drop, DB Create, Table Drop, Table Create)
Data: INSERT
Output: Single .sql file
Filename: <file of your choice>

Select multiple tables in different databases to export.
Click Export.

File created does not have "Use Database" statements so it is impossible to import the exported data without editing the file.
ansgar's profile image ansgar posted 9 years ago Permalink
Hm, i think this needs a new checkbox option then.

Users can check "Create database", which then not only creates a database, but also include a "USE db" after the "CREATE DATABASE" command. But if you uncheck "Create database", then there is no possibility of selecting it, although HeidiSQL provides a multi-db export.

I think I should modify the dialog as follows:
Database(s): [ ] Drop  [ ] Create + Use  [ ] Use
[expired user #8536]'s profile image [expired user #8536] posted 9 years ago Permalink
I think of the Database and Table checkboxes as structure, not data related. You then have the Data dropdown to decide if and how to dump the table data. Would it be more appropriate to move all "Use" inclusion to the Data dropdown? Because if I only dump the DB structure (by selecting "No Data") there is no need for "Use" statement (right?).
ansgar's profile image ansgar posted 9 years ago Permalink
Hm, you could want to create tables in two existing databases, where you don't want to recreate the databases themselves because they contain some other tables as well.

Please login to leave a reply, or register at first.