>I import a CSV flat file into a table (using sqliteman as GUI).  The 
>flat file has NULL values as simply no data between two delimiters (I 
>use 'tab' as Delimiter).
>
>The resulting table does not treat 'no data' between 2 delimiters as 
>NULL.  When I run CHECK constraints etc. on it it behaves as if the 
>'no data' was some value.  For example in a query it will show an 
>empty value but not as NULL (I can see this as SQLiteman has 
>highlights showing NULL fields).
>
>How can I set up Sqlite so it will read 'no data' between two 
>delimiters as NULL on file import?  Thanks

I believe it isn't as much an issue that's up to SQLite itself to 
manage, but rather the import tool you use.

While Igor is right to point out that NULLs were never mentionned in 
any .CSV RFC/document, it is still possible for an import tool to adopt 
a [private] convention, like:

"col_1","col_2","col_3"
"abc",123,"def"
,456,
"ghi",,"jkl"

being imported as

abc|123|def
null|456|null
ghi|null|jkl

but this requires a contract between the .csv producer[s] and the 
importer, as well as the use of text delimiters in order to 
differentiate an empty string from a null.

 From this point of view, SQLite has little control over that.  You can 
probably modify your copy of the CLI to adopt this convention, or write 
your own importer, which isn't hard if you don't try to make it 
universal but instead highly proprietary.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to