使用ssis中的派生列连接列 [英] Concatenate columns using derived column in ssis

查看:38
本文介绍了使用ssis中的派生列连接列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现的是Column 5:

Column 1 Columns 2 Column 3 Column 4  Column 5
A        B                  D         A|B|D

我使用了派生列:

(DT_STR,50,1252)([A] + "|" + [B] + "|" + [C] + "|" + [D])

但我以:

Column 1 Columns 2 Column 3 Column 4  Column 5
A        B                  D         A|B||D

我正在努力寻找正确的解决方案.

I'm struggling to find the right solution.

推荐答案

这应该可以解决问题:

(DT_STR,50,1252)((Column1 == "" ? "" : Column1 + "|") + (Column2 == "" ? "" : Column2 + "|") + (Column3 == "" ? "" : Column3 + "|") + (Column4 == "" ? "" : Column4))

基本上,您需要检查每列中的空值,并根据列位置与空字符串或列内容以及可选的分隔符连接.

Basically, you need to check for an empty value in each column and concatenate with either empty string or the column content, and an optional separator depending on column location.

这篇关于使用ssis中的派生列连接列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆