简体   繁体   English

ssis case语句派生列

[英]ssis case statement derived column

still learning about SSIS还在学习 SSIS

I have an excel source in SSIS, I need to create a case statement based on one of the columns [Teacher]我在 SSIS 中有一个 excel 源,我需要根据其中一列[Teacher]创建一个案例语句

but as a derived column (as it does not work in the SQL statement)但作为派生列(因为它在 SQL 语句中不起作用)

the normal SQL would be正常的 SQL 将是

CASE WHEN [Teacher] like '%A%' then [Teacher] else null end as [Teacher]

I have tried to look for examples, but can't find any with use of the like '%A%'我试图寻找示例,但找不到任何使用“%A%”之类的示例

please help请帮忙

You should use conditional with FINDSTRING() function as following (assuming that [Teacher] column is of type DT_WSTR ) :您应该使用FINDSTRING() function 条件如下(假设[Teacher]列的类型为DT_WSTR

FINDSTRING([Teacher],"A",1) > 0 ? [Teacher] : NULL(DT_WSTR,50)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM