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
------



>
> Note there's only line in the entire file, so there are no duplicates
> or misformatted entries.
>
> --
> 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.
>



-- 
Puneet Kishor http://www.punkish.org/
Carbon Model http://carbonmodel.org/
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org/
Science Commons Fellow, Geospatial Data http://sciencecommons.org
Nelson Institute, UW-Madison http://www.nelson.wisc.edu/
-----------------------------------------------------------------------
collaborate, communicate, compete
=======================================================================
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to