Skip to content
Advertisement

concatenate tinyint datatypes column using derived column in ssis

I have asked a similar Question before but this time I have problems with single-byte unsigned integer

What I am trying to achieve is Column 5:

Column 1 Column 2 Column 3 Column 4  Column 5
1        2      3                    1|2|3

Columns 1, Column 2, Column 3 and Column 4 data types is Tinyint but for Column 5 I need it as a string preferably varchar 100.

So I tried:

(DT_STR,100,1252)((ISNULL([Column 1]) ? "" : ([Column 1])) + (ISNULL([Column 2]) ? "" : ("|" + [Column 2])) + (ISNULL([Column 3]) ? "" : ("|" + [Column 3])+ (ISNULL([Column 4]) ? "" : ("|" + [Column 4]))) 

But I can’t seem to get it to work.

Advertisement

Answer

In SSIS expressions, you must cast all columns to DT_STR, before attempting to concatenate them, as concatenating TINYINT’s will give you an error. So you must do something like this instead:

(DT_STR,100,1252)((ISNULL([Column 1]) ? "" : (DT_STR,3,1252)[Column 1]) + ...

Also, pay close attention to your parenthesis, as the SSIS expression error messages really don’t help you in determining the cause of your error.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement