Re: [sqlite] NULL vs ''

2009-12-08 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ted Rolle, Jr. wrote:
> When I .import a file into a table, || results in a value of '' for the
> data item.
> How can I get a NULL value stored?

The SQLite shell cannot read your mind to determine if a zero length string
should be a zero length string or null.

> This also happens when the item is at the end (EOL) of the row.

Yes, a zero length string is a zero length string.  Each row has a number of
columns and the import code is column based.  The position of a column (eg
end of row) makes no difference.

> Currently, I:
> UPDATE table SET value=NULL where value='';

What is wrong with that?  You cam also use more complicated expressions in
the where and set clauses.  With CASE you can get really creative.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksetxAACgkQmOOfHg372QQIsgCgopjIfP+90n0yFnKM09+Vm8JT
EBgAoLewVDulprTL757sp1jtMrNZX3eY
=HXHu
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] NULL vs ''

2009-12-08 Thread Ted Rolle, Jr.
When I .import a file into a table, || results in a value of '' for the
data item.
How can I get a NULL value stored?
This also happens when the item is at the end (EOL) of the row.
Currently, I:
UPDATE table SET value=NULL where value='';

Ted

---

3.14159265358979323846264338327950  Let the spirit of pi spread
2884197169399375105820974944592307  all around the world!
8164062862089986280348253421170679  http://pi314.at PI VOBISCUM!

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