Copy INSERT-Skript from Sqlite

diaroe's profile image diaroe posted 2 years ago in Import/Export Permalink

Hi Ansgar,

long time ago, I hope you are fine and healthy.

However, got a question :

I just have to convert a Sqlite-DB to MySql.

Therefore it would be great if result setS resp. table data from sqlite could be selected as MySql INSERTS.

As both dialects are established, maybe it is not so complicated to realize, is it?

Thanks for your answer and stay great

Dirk

ansgar's profile image ansgar posted 2 years ago Permalink

I would create the table structure in SQLite first, as this is not doable automatically from MySQL via HeidiSQL. Then you should be able to use the SQL export dialog in HeidiSQL to copy data from your SQLite session to MySQL:

Select the tables you need, rightclick, then click "Export database..":

Description

In the export dialog

  • deselect all DROP and CREATE options
  • select Data: INSERT
  • set Output to your MySQL session
  • select the database where your empty tables were created

Description

Then, click the "Export" button to copy the data.

If that produces any errors, post them here.

diaroe's profile image diaroe posted 2 years ago Permalink

Hi Ansgar,

thanks for explaining.

Transferring tables from SqLite to MySQL is a bit tricky, not only double-quotes and AUTOINCREMENT/AUTO_INCREMENT, just KEYS/INDEX on text-fields (must be changed to VARCHAR's, size must be guessed) and ambingous INTEGER values versus BIGINT's.

After that, data transfer is done fine by your description.

By the way I noticed, that INDEX/KEY are shown in table CREATE CODE but not saved, when table definition is exported to sql-file. Same with AUTOINCREMENT, maybe this is a misconfiguration by me.

Thanks a lod

Dirk

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