Subject Re: view porting problem
Author Fikret Hasovic
Hi Arno.
> (CASE
> WHEN COALESCE(EC_UsrID, 0) <> 0 THEN EC_UsrTS
> WHEN COALESCE(KV_UsrID, 0) <> 0 THEN KV_UsrTS
> WHEN COALESCE(OE_UsrID, 0) <> 0 THEN OE_UsrTS
> WHEN COALESCE(MD_UsrID, 0) <> 0 THEN MD_UsrTS
> ELSE 0
> END) as StatusTS
>
> or if EC_UsrID, KV_UsrID, OE_UsrID and MD_UsrID never has the value
0 (zero)
> then :
>
> (CASE
> WHEN EC_UsrID IS NOT NULL THEN EC_UsrTS
> WHEN KV_UsrID IS NOT NULL THEN KV_UsrTS
> WHEN OE_UsrID IS NOT NULL THEN OE_UsrTS
> WHEN MD_UsrID IS NOT NULL THEN MD_UsrTS
> ELSE 0
> END) as StatusTS

I have tried that, but I allways get error:

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Datatypes are not comparable in expression CASE.

What to do?
Any other SQL construction can give me the same result?

>
> Regards,
> Arno Brinkman
> ABVisie
>
Best regards
Fikret Hasovic
TAMP R&D Team