在SSIS中引用案例声明

时间:2019-06-07 14:40:00

标签: sql sql-server ssis expression etl

我正在设置一个程序包,以将excel电子表格导入到SQL数据库中。电子表格中有一列,我想选择关键字,然后将其放在新列中。在SQL中,这就像一个基本的case语句

case when column_A like '%Norwich%' then 'Norwich'
    when column_A like '%Ipswich%' then 'Ipswich'
    when column_A like '%Cambridge%' then 'Cambridge'
    else 'NA'
end as NewColumn

我尝试了以下操作,但是我猜它不能正常工作,因为我现在有通配符

[Report Title] == "Norwich" ? "Norwich" : [Report Title] == "Ipswich" ? "Ipswich" : [Report Title] == "Cambridge" ? "Cambridge" : "NA"

示例:

Report Title                      NewColumn

Norwich is in Norfolk             Norwich
Cambridge is in Cambridgeshire    Cambridge
Suffolk is home to Ipswich        Ipswich

1 个答案:

答案 0 :(得分:1)

您必须将listeners函数与嵌套条件运算符配合使用才能实现:

FINDSTRING()

参考