2014-01-16 19 views
0

以前我問過這個問題,我相信已經得到了正確的答案,但我沒有。在ssis中使用派生列連接列

我所試圖實現的是​​:

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

我用一個派生列:

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

但我結束了:

Column 1 Columns 2 Column 3 Column 4 Column 5 
A  NULL  NULL  D  NULL 

如果我得到空的總體回答爲NULL

+0

可能重複(HTTP ://stackoverflow.com/questions/20597737/concatenate-columns-using-derived-column-in-ssis) – billinkc

回答

0

嘗試這樣的:[在SSIS使用派生列串聯列]的

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

=== 您好嘗試使用

ISNULL(Value) ? " " : Value 

對於每一列

馬里奧