Hello,

I am having trouble with a SQLite  IFNULL and replace statements.  I am
trying to put a value into a column that has no value / has a zero length.
   I am wondering whether anyone can shed light on this.

I'm trying to set column firstname to 'xxx' if the column has a NULL value
(or has length = 0).   I am able to check the number of rows returned by
running a select statement with the following "where" clauses:
1)  where firstname IS NULL       -------------> 0 rows returned
2)  where length(firstname) = 0   -------------> returns 100 rows
3)  where firstname=""                --------------> returns 100 rows

The problem is that the IFNULL and REPLACE functions are not working in my
SELECT statement, so I am unable to set firstname = 'xxx' where no value
exists.

1) select IFNULL(firstname, 'xxx')                 <--------------- does
not set the value to 'xxx', which is consistent with (1) above
from tablename;

2) select replace(firstname, '','xxx')              <--------------- does
not set the value to 'xxx', which contradicts (3) above, as the string is
empty

Does anyone know how I can check the column and set it to a value if it has
nothing in it?

Thank you in advance!
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to