What makes you think field1 gets turned into a zero? Fields are really
typeless in SQLite3
Your .dump should look like this:
SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE QQQ([FIELD1] INTEGER, [FIELD2] TEXT);
sqlite> .mode csv
sqlite> .import qqq qqq
Error: cannot open "qqq"
sqlite> .import qqq.txt qqq
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE QQQ([FIELD1] INTEGER, [FIELD2] TEXT);
INSERT INTO "QQQ" VALUES('FIELD1','FIELD2');
INSERT INTO "QQQ" VALUES(1,'ABC');
INSERT INTO "QQQ" VALUES(2,'BCD');
INSERT INTO "QQQ" VALUES(3,'CDE');
COMMIT;
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bart Smissaert
Sent: Saturday, June 08, 2013 9:43 AM
To: General Discussion of SQLite Database
Subject: [sqlite] Strange table behaviour after text import with sqlite3.exe
Have table defined like this:
CREATE TABLE QQQ([FIELD1] INTEGER, [FIELD2] TEXT)
Table is empty, so has no records.
Then I import a text file with this data:
FIELD1,FIELD2
1,ABC
2,BCD
3,CDE
This is via sqlite3.exe with:
.mode csv
.import textfilename QQQ
Table will then be like this:
FIELD1 FIELD2
---------------------------------
0 FIELD2
1 ABC
2 BCD
3 CDE
This is all fine and as expected.
However I am unable to produce any records when doing a select
with a where clause specifying field1 to be zero.
Tried all:
select * from qqq where field1 = 0
select * from qqq where field1 = '0'
select * from qqq where field1 = ''
select * from qqq where field1 is null
Nil producing a record.
Any idea what is going on here or what I might be doing wrong?
RBS
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users