Subject Re: [firebird-support] Null and LIKE Clause
Author Christianto Tjahyadi
I expect this because our old sql database can do. I will consider your
suggestions.

Thanks.

--chris

----- Original Message -----
From: "Martijn Tonies" <m.tonies@...>
To: <firebird-support@yahoogroups.com>
Sent: Tuesday, April 27, 2004 7:41 PM
Subject: Re: [firebird-support] Null and LIKE Clause




> I expect, when I do a SELECT with option WHERE COLUMN2 LIKE '%', all of
rows
> will be displayed, including the rows with COLUMN2 is null. But when I do
a

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 first
> character is 'A' will be displayed.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com





Yahoo! Groups Links