Home > Net >  How to import CSV file into an attached database?
How to import CSV file into an attached database?

Time:11-06

I am trying to import a CSV file into an attached database. Primary database is X.db, E.db is attached to it and contains table E_table.

I tried :

.mode csv
.import C:/1/05112022.CSV E.E_table

There are no error messages but CSV is not inserted into E_Table.

CodePudding user response:

You need to use the --schema option to the .import command, like so:

.import --schema E C:/1/05112022.CSV E_table

Note that you specify the attached schema in the option, and do NOT qualify the table name with the schema.

The docs for this option are here

Note that the --schema option requires SQLite version 3.38.0 or higher.

  • Related