Hi, while sqlite documentation on .import is generally a bit sparse (or I haven't found it), searching for it prominently yields this wiki page:
http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles The information given there seems out of date and partly incorrect. Contrary to "[...] Unfortunately, not all CSV files are simple. For instance, the CSV line "Last, First", 1234 means two columns in Excel (a name and an integer), but three columns with embedded quote marks in SQLite. Be wary when trying to import CSV files. Some problems you would encounter importing CSV files using the SQLite shell: - Fields with commas in them. The SQLite shell will always split fields on the separator character, no matter what comes before or after it. Quotes or backslashes won't escape them. - Quoted fields. The SQLite shell will interpret quotes literally, so the imported database will have embedded quote marks in them. [...]" .import nowadays *does* interpret double quotes: $ cat data.csv field1 field2 field3 text1 text"2 text3 1 2 3 0 $ sqlite3 SQLite version 3.7.17 2013-05-20 00:56:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table data (col1, col2, col3); sqlite> .separator "\t" sqlite> .import data.csv data Error: data.csv line 4: expected 3 columns of data but found 2 sqlite> select * from data; Looks like the new behaviour has been introduced here: http://www.sqlite.org/src/info/93aa17d866 Note that I don't know how "official" the wiki documentation is nor how to fix it myself (?), so this is a try to enhance documentation on csv import a bit wrt something I've run into (and wondered). Best regards, Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users