Subject RE: [firebird-support] Datatypes are not comparable in expression CASE - BUGG?
Author Alan McDonald
> 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

should be
SELECT
CASE WHEN TABLE_VACC.Vacc_1_d is null then something you want else default
end myfieldname
CASE WHEN... END
FROM TABLE

Alan

> 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
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>