Re: [sqlite] Error: datatype mismatch
On Fri, Feb 28, 2014 at 8:00 AM, Dominique Deviennewrote: > Ran into this [datatype mismatch] error, which surprised me since I > thought SQLite's > dynamic typing allowed any value type to be stored in any column. > The exception to that rule is an INTEGER PRIMARY KEY column, which is only allowed to store an integer. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Error: datatype mismatch (Yanhong Ye)
On Mon, Jul 16, 2012 at 9:29 PM, YAN HONG YE <yanhong...@mpsa.com> wrote: > I know the reason: > if I change the file encode to latin, it will suecess import the data; > but when I change the txt file to utf8 encode, It will get the error: > Error: datatype mismatch > I wanna know how to import utf8 encode file to my database? > Your easiest solution would be to run your script on either Mac or Linux. > > >Date: Mon, 16 Jul 2012 02:19:12 -0600 > >From: "Keith Medcalf" <kmedc...@dessus.com> > >To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> > >Subject: Re: [sqlite] Error: datatype mismatch > >Message-ID: <e490d863a81fdc4cbf3bf970f3c0b...@mail.dessus.com> > >Content-Type: text/plain; charset="us-ascii" > > > > > >sqlite> CREATE TABLE webinfo (inx INTEGER PRIMARY KEY ,website > varchar(50) UNIQUE,username varchar(50),password varchar(50)); > >sqlite> .mode csv > >sqlite> .import kk.txt webinfo > >sqlite> select * from webinfo; > >0,nytime,gf,a1..7 > >1,bbc,1982,tbth432 > >2,oknic,y...@sohu.com,bbaa1122 > >sqlite> > > > >Did you forget to say ".mode csv"? > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Error: datatype mismatch (Yanhong Ye)
I know the reason: if I change the file encode to latin, it will suecess import the data; but when I change the txt file to utf8 encode, It will get the error: Error: datatype mismatch I wanna know how to import utf8 encode file to my database? >Date: Mon, 16 Jul 2012 02:19:12 -0600 >From: "Keith Medcalf" <kmedc...@dessus.com> >To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> >Subject: Re: [sqlite] Error: datatype mismatch >Message-ID: <e490d863a81fdc4cbf3bf970f3c0b...@mail.dessus.com> >Content-Type: text/plain; charset="us-ascii" > > >sqlite> CREATE TABLE webinfo (inx INTEGER PRIMARY KEY ,website varchar(50) >UNIQUE,username varchar(50),password varchar(50)); >sqlite> .mode csv >sqlite> .import kk.txt webinfo >sqlite> select * from webinfo; >0,nytime,gf,a1..7 >1,bbc,1982,tbth432 >2,oknic,y...@sohu.com,bbaa1122 >sqlite> > >Did you forget to say ".mode csv"? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Error: datatype mismatch
sqlite> CREATE TABLE webinfo (inx INTEGER PRIMARY KEY ,website varchar(50) UNIQUE,username varchar(50),password varchar(50)); sqlite> .mode csv sqlite> .import kk.txt webinfo sqlite> select * from webinfo; 0,nytime,gf,a1..7 1,bbc,1982,tbth432 2,oknic,y...@sohu.com,bbaa1122 sqlite> Did you forget to say ".mode csv"? --- () ascii ribbon campaign against html e-mail /\ www.asciiribbon.org > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of YAN HONG YE > Sent: Monday, 16 July, 2012 01:30 > To: sqlite-users@sqlite.org > Subject: [sqlite] Error: datatype mismatch > > the table is: > CREATE TABLE webinfo (inx INTEGER PRIMARY KEY ,website varchar(50) > UNIQUE,userna > me varchar(50),password varchar(50)); > > and the txt file kk.txt is utf8: > 0,nytime,gf,a1..7 > 1,bbc,1982,tbth432 > 2,oknic,y...@sohu.com,bbaa1122 > > when I use > " .import kk.txt webinfo" > in cmd line I got the error msg: > Error: datatype mismatch > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Error: datatype mismatch
On Mon, Jul 16, 2012 at 3:30 AM, YAN HONG YEwrote: > the table is: > CREATE TABLE webinfo (inx INTEGER PRIMARY KEY ,website varchar(50) > UNIQUE,userna > me varchar(50),password varchar(50)); > > and the txt file kk.txt is utf8: > 0,nytime,gf,a1..7 > 1,bbc,1982,tbth432 > 2,oknic,y...@sohu.com,bbaa1122 > > when I use > " .import kk.txt webinfo" > in cmd line I got the error msg: > Error: datatype mismatch > = Hello, YAN HONG YE The default separator is a vertical bar (virgule, |) but I would think you'd get error: Error: kk.txt line 1: expected 4 columns of data but found 1 You are sure you get Error: datatype mismatch ? When I add, before the .import command, .separator , then I successfully imported your kk.txt when I tried this on versions 3.7.9 and 3.7.13 on Ubuntu. What version of sqlite3 and what operating system are you using? By the way, you may already know that your varchar(n) specs are pretty much comments and sqlite will simply set TEXT affinity, Donald ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users