Subject Re: [firebird-support] Null and LIKE Clause
Author Martijn Tonies
> >When we use LIKE '%', adding OR COLUMN2 IS NULL will solve the problem.
But
> >when we use LIKE 'A%', the rows with null columns will be displayed too.
I
> >will put '%' or 'A%' in a bind variable.
>
> Do this:
>
> 1. Alter column COLUMN2 to have default '';

Do note, that the DEFAULT is ONLY applied when you
leave the COLUMN2 column from the INSERT INTO
statement. If you want to make sure it has '' instead of NULL,
create a BEFORE INSERT and BEFORE UPDATE trigger.

> 2. UPDATE X SET COLUMN2='' WHERE COLUMN2 IS NULL;


With regards,

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