On 15 Feb 2010, at 2:50pm, Phil Hibbs wrote: > If I write out data in csv format using SQLite3 shell, it doubles up > all the quote characters. Any ideas how can I stop it doing this? > > C:\sqlite>sqlite3 test.db > SQLite version 3.6.22 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> create table test ( f1 varchar(100) ); > sqlite> insert into test values('test 1'); > sqlite> insert into test values('test "2"'); > sqlite> .mode csv > sqlite> .output test.csv > sqlite> select * from test; > sqlite> .quit > > C:\sqlite>type test.csv > "test 1" > "test ""2"""
Good problem description and debug text. It's doubling quotes up because they're inside quoted text strings. I don't see an easy way to change it. Unfortunately, I don't think any global change command will help you solve the problem. You can't change all occurences of three quotes in a row because you don't know whether they're at the beginning or end of a field. Depending on how complicated your output is, you might instead use a different .mode . Perhaps 'list' or 'tabs' might give you something you can clear up more easily. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users