January 23, 2015 at 9:55 am
Hi, please help me to get below logic in Derived transformation, SSIS.
Logic:ensure the Docket number is 5 digits and populate with leading zeros if not.
I have to check input number field is 5 digits, if not I have to populate with leading zeros to make it as 5 digits.
It will be more helpful if any one got me the logic.
January 23, 2015 at 10:27 am
any one that will be more appreciated , if question is not clear let me know.
January 23, 2015 at 10:45 am
In a Derived Column transformation you can do this:
LEN(Docket) < 5 ? REPLICATE("0",5 - LEN(Docket)) + Docket : Docket
This basically says, if the length of Docket is less than 5 then prepend 0's (5 - the length of Docket) Else just give me the value in Docket. This does assume that the incoming column is a string and not an integer.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
January 23, 2015 at 10:47 am
Thank you , will let you know if it is working or not.
January 23, 2015 at 11:00 am
What about
right('0000' + Docket,5)
January 23, 2015 at 11:07 am
gilbert delarosa (1/23/2015)
What aboutright('0000' + Docket,5)
Yeah, that would work and is probably better.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply