Replace Function in Ssis

There are 3 column in my Sender Master table, First_Name, Middle_Name,Last_Name. Whenever I am loading data from a csv file, Last name gets filled in Middle name. I am trying to Replace Last_Name with middle using Derived Expression but getting failed every time..

I have tried this code but getting last name in both the fields. I want to replace Last name with middle and make middle name column blank.

LastName == " " ? REPLACE(lastName,"",MiddleName) : LastName
1

2 Answers

Why using replace function? Just use the following expression:

LTRIM(LastName) == "" ? MiddleName : LastName

And for MiddleName column, replace it with the following derived column:

LTRIM(LastName) == "" ? "" : MiddleName

So this is your request... "I want to replace Last name with middle and make middle name column blank."

Make new columns instead of replacing data.

drvLastName = MiddleName
drvMiddleName = ""

You can now map these new columns to your table.

NOTE:

REPLACE is used for switching out chars in a string for example.

REPLACE("String,With,Commas",","," ")

will return: "String With Commas"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest