SQLite Forum

How to import a csv file whose columns are separated by semicolons
Login
Hi

I have a base with 81,372,577 observations and whose columns are separated by semicolons. I am using the following command to import this database:

`.mode csv
.separator ";"
.import c: /users/inspiron/desktop/people2012.csv people2012`

However, the result for this command is:

`CREATE TABLE people2012 (...) failed: duplicate column name:`

So, as the procedure didn't work, I tried to create the table first (with the columns separated by a comma):

`CREATE TABLE people2012 (
cod_familiar_fam NUMERIC NULL,
num_membro_fmla INT NULL,
...
);`

Then, follow these steps:

`.separator ";"
.import c: /users/inspiron/desktop/people2012.csv people2012`

The result of which is:

`c: /users/inspiron/desktop/pessoas2012.csv:11: expected 120 columns but found 1 - filling the rest with NULL`

However, when specifying the base, there is no value in the columns. Only periods and commas appear.

`sqlite> select * from people2012 limit 10;
"??c";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"" ; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; " ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" "; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "" ; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; " ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" ";" "; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "" ; ""; ""; ""; ""`