I'm new to sqlite3 and couldn't find any documentation on the .import
command, so a pointer to the docs may be all that's needed. Sorry if
this is simple...

My problem is that I have been trying to .import null values from a
delimited text file (colon is delimiter) with no success. Here is an
example:

Table definition:
create table test (
        col1 REAL,
        col2 REAL default NULL,
        col3 REAL default NULL,
        col4 REAL default NULL
);


Example data (3rd column has 2 null values)
2452570.708333:9.7::0.00
2452570.718750:9.6::0.00
2452570.729167:9.6:22.2:0.00
2452570.739583:9.4:23.4:0.00

sqlite> .import /home/david/test.txt test

sqlite> select * from test;
2452570.708333:9.7::0
2452570.71875:9.6::0
2452570.729167:9.6:22.2:0
2452570.739583:9.4:23.4:0

sqlite> select * from test where col3 is null;
sqlite>

sqlite> select * from test where col3 == "";
2452570.708333:9.7::0
2452570.71875:9.6::0

sqlite> insert into test values(1,2,null,3);
sqlite> select * from test;
2452570.708333:9.7::0
2452570.71875:9.6::0
2452570.729167:9.6:22.2:0
2452570.739583:9.4:23.4:0
1:2:NULL:3
sqlite> select * from test where col3 is null;
1:2:NULL:3

So, obviously I didn't import a null value, I imported "".  I've got
100,000+ records to import, I am hoping not to have to insert them
all. Any advise?

Thanks,

David

$ sqlite3 -version
3.2.1
$ uname -a
Linux x 2.6.12-9-686 #1 Mon Oct 10 13:25:32 BST 2005 i686 GNU/Linux





This results in a tab "\t" in place of null.

2452570.708333:9.7:null:0.00
2452570.718750:9.6:null:0.00
2452570.729167:9.6:null:0.00
2452570.739583:9.4:null:0.00



--
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA  98195-7940
USA

Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays

Reply via email to