is there a way of replicating the below expression in SSIS Derived Column?
SELECT CASE
WHEN LEN(column1) > 8
THEN
column1
ELSE
REPLICATE('0', 18 - LEN(column1)) + column1
END AS column1
FROM myTable
I want to pad the value of column1 with 0 if the lenght of the value is less than 8 character
The SSIS expression language supports the ternary operator
? :That expression ought to work but it doesn’t because the REPLICATE call is going to provide metadata back stating it’s 4k nvarchar characters (the limit). If you’re deadset on getting it to work that way, comment and I’ll hack the expression to size the output of replicate before concatenating with
column1An easier approach is to just always add 8 leading zeros to the expression and then slice it off from the right.
You might need 18 on the second as your example seemed to use 18 but the concept will be the same.