In SSIS package I have derived column in which I want to format phone like below:
CASE
WHEN TRY_CONVERT(BIGINT, phone) IS NULL THEN
NULL
ELSE
phone
END
How can I use the SSIS expression to achieve same result as above?
In SSIS package I have derived column in which I want to format phone like below:
CASE
WHEN TRY_CONVERT(BIGINT, phone) IS NULL THEN
NULL
ELSE
phone
END
How can I use the SSIS expression to achieve same result as above?
You have to use the following expression:
(DT_I8)[Phone] == (DT_I8)[Phone] ? [Phone] : NULL(DT_WSTR,50)
Note that you have to replace (DT_WSTR,50)
with the data type of column [Phone]
. Click here for more information
And in the derived column error output change the on error option to Ignore Failure
You can also achieve this using a script component:
Use a similar code
if(!Row.Phone_IsNull && !String.IsNullOrEmpty(Row.Phone) && Int64.TryParse(Row.Phone, out long number)){
Row.OutPhone = Row.Phone;
}else{
Row.OutPhone_IsNull = true;
}
© 2022 - 2024 — McMap. All rights reserved.