Gilles wrote: > At 22:47 04/02/2008 +1100, John Machin wrote: >> Well, obviously(?) you are closer to success with "\t" than with '\t'. >> You probably have an extra unseen TAB. It won't like that NULL. > > Thanks, but no matter what I try, it doesn't work: > - just two columns, assuming it will just increment the primary key since > it didn't find anything for this column > - three columns, with col#1 set to "NULL" > - three columns, with col#1 set to just ASCII 09, ie. TAB > > How is your "barzot.tsv" formatted? How do you handle the first column that > works as an auto-incremented primary key? >
Gilles, You can't import into an auto-incremented field. The import command always inserts a value into each column of the table that is being imported into. There is no way to import a null value. Your datatype mismatch error is caused by your attempt to insert the string 'NULL' into the id column. Because this column is declared as integer primary key it can only store integer row id values (unlike all other columns in SQLite). You will need to do your import in two steps. First import into a temp table without the integer primary key column. CREATE TEMP TABLE temp_customer ( tel VARCHAR(32), name VARCHAR(255)); .sepatator \t .import test.csv temp_customer Then copy the data from the temp table into the final table leaving the id unassigned, and finally drop the temp table insert into customer select null, tel, name from temp_customer; drop table temp_customer; HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users