Consider we have a table tmp with an attribute c1 taking the values
c1={'1','10','20'}
You would like to complete a 3 character attribute with zero before the existing values ( knowing as "LEADING ZEROS"), this is sql code to goal thi result
ris={'001','010','020'}
SELECT RIGHT('00000'+ CONVERT(VARCHAR,c1),3) AS ris FROM tmp;