Subject | Re: [firebird-support] Null and LIKE Clause |
---|---|
Author | Martijn Tonies |
Post date | 2004-04-27T12:41:13Z |
> I expect, when I do a SELECT with option WHERE COLUMN2 LIKE '%', all ofrows
> will be displayed, including the rows with COLUMN2 is null. But when I doa
Why? NULL doesn't equal/like '%'.
NULL is NO VALUE. It's a state. A column can have
two states: NULL or NOT NULL. It can have many
values though. You're using a value operator (LIKE).
Value operators don't operate on states (NULL).
The next best thing you can do, is perhaps something
with COALESCE:
WHERE COALESCE (Column2, '') LIKE '%'
> SELECT with option WHERE COLUMN2 LIKE 'A%", only rows with the firstWith regards,
> character is 'A' will be displayed.
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com