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...
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
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"