【发布时间】:2019-06-07 14:40:00
【问题描述】:
我正在设置一个包以将 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
【问题讨论】:
标签: sql sql-server ssis expression etl