Subject Datatypes are not comparable in expression CASE - BUGG?
Author mielhostens
Dear all,

I recently tried a certain select query on a firebird 2.1 database
engine (on windows xp – service pack 2) with both firebird maestro
and ibexpert development software

This one fails

select
Case TABLE_VACC.Vacc_1_D
When Null
Then DATEADD(
day,
(select VACC_1_INT from TABLE_VACCPROT where
TABLE_VACCPROT.ProtocolID = TABLE_VACC.VACCPROTOCOL),
(select birthday from TABLE_COWS where TABLE_COWS.cowregnumber =
TABLE_VACC.CowRegNumber )
)
Else TABLE_VACC.Vacc_1_D
End
from
TABLE_VACC;

When I drop the else statement it fails strangely enough and reports
an error as
"Datatypes are not comparable in expression CASE"

This is quite surprising as both statements are dates,

I checked all tables, works fine
When you seperatly query the dateadd statement everything works fine

Any ideas?

Miel Hostens