add leading zero in ssis
Hi I have varchar column and i want to add zaro in that if length of column is 1 then add 0 example :: 1 then 01 11 then 11 please someone tell me how to write expression
September 28th, 2011 2:33pm

Use derived column transformation. Expression will be RIGHT("00" + yourcolumnname)
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 2:40pm

A minor correction to the expression(@Debu you missed the numeric part): RIGHT("00"+[ColumnName],2)My Blog | Ask Me
September 28th, 2011 2:49pm

Thanks Sudeep. Made that mistake while copying from my code.
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 2:55pm

its not adding zero
September 28th, 2011 2:58pm

what is the expression that you are using? What is the data type of the column? if it is int it will not do this because 01 == 1. You would need to change it to string. My Blog | Ask Me
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 2:58pm

I 'd solve it with this: REPLICATE("0", 2-LEN((DT_WSTR,2)yourcolumnname)) + (DT_WSTR,2)(yourcolumnname) Arthur My Blog
September 28th, 2011 3:00pm

datatype is varchar and i am using same expression that u gave
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 3:09pm

Good, I realize this, I just cut and pasted from my package.Arthur My Blog
September 28th, 2011 3:13pm

Hi Sudeep thank you so much it was my mistake your code is working
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 3:13pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics