Maria Wollestonecraft
Maria Wollestonecraft

Reputation: 496

SQLITE 3.9.0, Windows 10 x64 - How to import a .csv from the command line shell?

I can do it using the GUI (not that hard) but I really would like do to it by sqlite command lines. I've googled it and have tried everything, however nothing seems to work. Please give me a hint on this! This is the last thing I've tried:

CREATE TABLE 'teste3' (
'Id'    integer,
'Idade' integer,
'Sexo' text,
'Peso' integer
 );
.separator ',';
.mode csv;
.import 'C:\Users\xxxx\Documents\Monografia\base_teste.csv' teste3

What I intended to do was to create a table ('teste3',done) and them "fill it" by importing a given .csv file. Instead, I keep getting this error message: "near ".": syntax error:". Then I tried to cut off the "." before separator, for example, but I got another error: "near "separator": syntax error:". I really don't know what to do. Thanks!

Upvotes: 0

Views: 316

Answers (1)

CL.
CL.

Reputation: 180210

Dot commands like .mode and .import are not SQL statements; they are implemented by the sqlite3.exe command-line shell (which can be downloaded from the offical SQLite site).

The DB Browser for SQLite is an entirely independent tool. It does not implement these dot commands; you have to use the GUI instead.

Upvotes: 0

Related Questions