Derived Column to handled mulitple conditions in CASE expression
15:49 24 Jan 2022

I've got a CASE expression that works, but because I have to do it in SSIS, I am at a loss:

SELECT [BPCNUM_0], TYPE,

CASE

    WHEN [TYPE]=1 THEN 'Normal'
    WHEN [TYPE]=2 THEN 'Divers'
    WHEN [TYPE]=3 THEN 'Intra-Société'
    WHEN [TYPE]=4 THEN 'Prospect'
END AS TYPE
FROM table

As you can see, the case expression evaluates values in one column and renames them depending on what they are.

When I tried this with SSIS, it didn't work

[TYPE] == 1 ? "Normal" : [TYPE] == 2 ? "Divers" : [TYPE] == 3 ? "Intra-Société" : [TYPE] == 4 ? "Prospect"

I tried also

[TYPE] == "1" ? "Normal" : [TYPE] == "2" ? "Divers" : [TYPE] == "3" ? "Intra-Société" : [TYPE] == "4" ? "Prospect"

but also it didn't work.

sql sql-server ssis