I am new to SSIS and I want to import data from the SQL database to a flat-file.
I have a column name named SecurityNumber
which contains sensitive data, so using a derived column I want to use a symbol * to hide some numbers.
For example, if the column has a value 1983121802 and
if substring 3 plus substring 4 (in this case 8+3) is less than 13 display the column as **83******
or else display the whole value (1983121802
)
how can I do that?
and the column SecurityNumber
has a string data type, How can I change it to another data type so it's possible to make the comparison?
Thank you for your help!
Asked
Active
Viewed 34 times
2
1 Answers
0
Try to use the following expression:
((DT_I4)SUBSTRING([SecurityNumber],3,1) + (DT_I4)SUBSTRING([SecurityNumber],4,1)) > 13 ? [SecurityNumber] : "**" + SUBSTRING([SecurityNumber],3,2) + "******"

Hadi
- 36,233
- 13
- 65
- 124