[英]SSIS Combine Multiple Columns into one with nulls
我知道以前曾问过类似的问题,但是我有一个独特的案例,以前的答案并没有解决。
我有一个数据库行,其中有5个注释列,我想合并为一个。 例:
ID NAME CMT1 CMT2 CMT3 CMT 4 CMT5
1 John BLAH BLAH null null null
2 Mary BLAH null null null null
3 Sue BLAH BLAH BLAH BLAH BLAH
我希望看到以下内容:
ID NAME CombinedComment
1 John BLAH BLAH
2 Mary BLAH
3 Sue BLAH BLAH BLAH BLAH BLAH
现在要告诫。
1. I cannot use SQL to join the data. The data comes from a linked server via a stored procedure. This is the usual response to this problem.
2. I cannot modify the stored procedure.
3. I am using a Derived Column and using the following:
Combined CMT1 + " " + CMT2 + " " + CMT3 + " " + CMT4 + " " + CMT5
This works only for rows that have a value in ALL 5 comment fields.
综上所述,即使其他注释字段中没有null,我也希望“合并注释”列适用于所有行。
在派生列转换中使用
ISNULL(CMT1)? "":CMT1
要么
REPLACENULL(CMT1,"")
在评论字段周围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.