Eric Matthew Finnin
2006-10-02 07:43:50 UTC
Could someone tell me the syntax for the .import command? I can't
seem to get my null values to be recognized.
First I created test1:
CREATE TABLE [test1] (
[col1] INTEGER NOT NULL,
[col2] TEXT NULL,
[col3] INTEGER NULL
)
The data for test1.csv has the following data:
col1,col2,col3
1,yes,13
2,no,NULL
3,NULL,34
4,yes,22
5,yes,25
This appears successful:
sqlite> SELECT col1, col3 FROM test1;
1|13
2|NULL
3|34
4|22
5|25
But then I get the following results:
sqlite> SELECT * FROM test1 WHERE col3 IS NULL;
sqlite> SELECT * FROM test1 WHERE col3 IS NOT NULL;
1|yes|13
2|no|NULL
3|NULL|34
4|yes|22
5|yes|25
sqlite> SELECT * FROM test1 WHERE col3 = 'NULL';
2|no|NULL
sqlite>
And if I use SQLite Administrator, the table is imported into my
database without an error, except all NULL values take the value 0.
Thank you for any suggestions.
-----------------------------------------------------------------------------
To unsubscribe, send email to sqlite-users-unsubscribe-CzDROfG0BjIdnm+***@public.gmane.org
-----------------------------------------------------------------------------
seem to get my null values to be recognized.
First I created test1:
CREATE TABLE [test1] (
[col1] INTEGER NOT NULL,
[col2] TEXT NULL,
[col3] INTEGER NULL
)
The data for test1.csv has the following data:
col1,col2,col3
1,yes,13
2,no,NULL
3,NULL,34
4,yes,22
5,yes,25
sqlite3 -header -separator , -nullvalue NULL test.s3db ".import
test1.csv test1"This appears successful:
sqlite> SELECT col1, col3 FROM test1;
1|13
2|NULL
3|34
4|22
5|25
But then I get the following results:
sqlite> SELECT * FROM test1 WHERE col3 IS NULL;
sqlite> SELECT * FROM test1 WHERE col3 IS NOT NULL;
1|yes|13
2|no|NULL
3|NULL|34
4|yes|22
5|yes|25
sqlite> SELECT * FROM test1 WHERE col3 = 'NULL';
2|no|NULL
sqlite>
And if I use SQLite Administrator, the table is imported into my
database without an error, except all NULL values take the value 0.
Thank you for any suggestions.
-----------------------------------------------------------------------------
To unsubscribe, send email to sqlite-users-unsubscribe-CzDROfG0BjIdnm+***@public.gmane.org
-----------------------------------------------------------------------------