SQL CASE Statement with Boolean

LabKey Support Forum (Inactive)
SQL CASE Statement with Boolean Jon (LabKey DevOps)  2017-03-07 01:14
Status: Closed
 
Hi Bront,

I think it is supposed to look like this:

SELECT
CAST (
     CASE
         WHEN Message.gender = 'M' then 1 ELSE 0
     END
AS BIT)
 as booleanTest
FROM Message
WHERE Message.messageId = '12345';

Since the use of CAST is basically "CAST (expression AS type)", then the CASE would have to be an expression here.

Can you give the above a try?

Regards,

Jon