2009/10/22 Scott Baker <bak...@canbytel.com>: > I'm trying to .import a CSV file and I can't quite figure out the syntax. > > I created a table, and then did: > > .separator , > .import /tmp/foo.csv mytable > > This works sort of, unless my data has , in it. Something like "last, > first". Because it tries to split at that , and then the number of rows > doesn't match my table. > > Then I tried setting the separator to > > .separator \",\" > > Which works correctly (i.e. it splits the data properly). However, now my > first and last columns have " on the beginning/end of them. Is there a way > to import a well formed CSV. > > My CSV data looks like this: > > "38665","101977","Deadly Sparrows Inc.","1435 S. Doolis > Ln","Donkville","OR","90210","Doolis, Jason","5032349422","Active" > > Help!
There was a discussion on csv import a little while ago: http://www.nabble.com/Tedious-CSV-import-question-to25601326.html#a25601326 In essence, you need to do some work if your field separator character appears inside your data fields. One solution is to replace your existing separators (,) with a character that does not exist in your data, specify that character as the separator to sqlite, and you should be good to go .import. > > -- > Scott Baker - Canby Telcom > System Administrator - RHCE - 503.266.8253 Rgds, Simon _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users