Reputation: 2896
This is my sqlite code:
create table A(A1 text, A2 text);
.separator ","
import outData.csv A
I get an error statement as so:
outData.csv Line 4: expected 2 columns of data but found 4
This is what Line 4 looks like:
Hallieo,"h, a, and ll"
I understand why the error message comes up. But I was wondering if anyone can suggest a way for me to store - "h, a, and ll" as one record. Thus being able to override the separator command in the presence of a double inverted comma.
Thanks in advance for any help.
Upvotes: 1
Views: 199
Reputation: 20596
The tokenizer, which is what splits a line up into individual fields, in the sqlite3 console program is straightforward and not up to this challenge.
You will have to write your own program to read the file line by line, tokenize each line, and store into the database. An entertaining challenge that will occupy a day if you really know your programming language.
Myself, I use C++ and for this sort of thing would use boost::tokenizer. http://www.boost.org/doc/libs/1_46_0/libs/tokenizer/tokenizer.htm
Upvotes: 2