Ha.. ignore my previous reply then. Glad it works for you!

On 2015-07-30 10:40 PM, Sylvain Pointeau wrote:
>>
>> ?I am replying to your original message rather that later ones because I'm
>> curious about the CSV file which is giving you a problem. Using the sqlite3
>> command on Linux Fedora 22 (64 bit), I get the following (transcript):
>>
>> $sqlite3
>> SQLite version 3.8.10.2 2015-05-20 18:17:19
>> Enter ".help" for usage hints.
>> Connected to a transient in-memory database.
>> Use ".open FILENAME" to reopen on a persistent database.
>> sqlite> create table test(name1 text, name2 text, name3 text);
>> sqlite> .mode csv
>> sqlite> .import ./test.csv test
>> sqlite> .mode lines
>> sqlite> select * from test;
>> name1 = name1
>> name2 = name2
>> name3 = name3
>>
>> name1 = line1a
>> name2 = line1b
>> name3 = line1c
>>
>> name1 = line2"a
>> name2 = line2b
>> name3 = 'line2b'
>> sqlite> .quit
>> joarmc at mckown5 2015-07-30T14:43:21 ~/junk
>> $cat test.csv
>> name1,name2,name3
>> "line1a",line1b,line1c
>> "line2""a",line2b,'line2b'
>> joarmc at mckown5 2015-07-30T14:43:25 ~/junk
>
> Well ... I am glad that you are right.
>
> When I saw your message, I wondered why it didn't work for me.
>
> I have taken back my samples:
>
> $ cat test.csv
> A,B,C
> T,TI,TIT
> "A,B",C,D
> "1st line
> 2nd line",E,F
>
> sqlite> .mode csv
> sqlite> .import test.csv T
> sqlite> select * from T;
> T,TI,TIT
> "A,B",C,D
> "1st line
> 2nd line",E,F
>
> I think this is where my mistake comes from, and when I did browse on
> internet, I saw some replies showing how to do an update to remove the
> quotes...
>
> now I should have done:
>
> sqlite> .mode csv
> sqlite> .import test.csv T
> sqlite> .mode list
> sqlite> select * from T;
> T,TI,TIT
> A,B,C,D
> 1st line
> 2nd line,E,F
> 0003,002,01
>
> so I was obviously wrong, sqlite import the csv very well, and I am glad to
> have been wrong!
>
> apologies for my mistake.
>
> Best regards,
> Sylvain
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to