David Finlayson wrote:
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:
David,
The .import command in sqlite always imports data as text (even numeric
data into numeric columns). There is no way to import a NULL value. The
closest you can get is an empty string or some other sentinel value,
like the string NULL (but that would require a couple of search and
replace operations in your source data file). Note, this will give you a
string containing the word NULL in these columns rather than an SQL NULL
value.
This can of course also be done is SQL as Kurt suggested.
Or you could write your own import program that reads in the file and
does the inserts with the correct data bound to the columns as the
correct type (see sqlite3_bind_double() and sqlite3_bind_null()).
HTH
Dennis Cote