On 6/6/09, P Kishor <punk.k...@gmail.com> wrote: > On Sat, Jun 6, 2009 at 8:28 PM, Kelly Jones<kelly.terry.jo...@gmail.com> > wrote: >> On 6/6/09, P Kishor <punk.k...@gmail.com> wrote: >>> On Sat, Jun 6, 2009 at 1:43 PM, Kelly Jones<kelly.terry.jo...@gmail.com> >>> wrote: >>>> I have a text file onenum.txt with just "1234\n" in it, and a db w/ >>>> this schema: >>>> >>>> sqlite> .schema >>>> CREATE TABLE test (foo INTEGER PRIMARY KEY); >>>> >>>> When I import, it fails as follows: >>>> >>>> sqlite> .import onenum.txt test >>>> Error: datatype mismatch >>>> >>>> Is sqlite3 treating "1234" as a string or something? Short of doing >>>> "INSERT INTO test VALUES (1234);", how do I import numbers into >>>> sqlite3's rowid column? [1] >>> >>> Remove the "\n" >> >> Er, by "\n", I just meant that the file ended in a newline. I didn't >> literally type a backslash and an 'n' into the file. > > > Yes, I understand what you meant. If there is a newline, sqlite tries > to import it, and that doesn't fit into the INTEGER PRIMARY KEY > categorization, hence the datatype mismatch error. So, the following > fails (I am typing bogus lines to indicate the newline > ------ > 1234 > > ------ > > while the following imports just fine > ------ > 1234 > ------
Thanks! That did the trick. I had an extra newline in the file. -- We're just a Bunch Of Regular Guys, a collective group that's trying to understand and assimilate technology. We feel that resistance to new ideas and technology is unwise and ultimately futile. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users