Link to home
Start Free TrialLog in
Avatar of amhinkel
amhinkelFlag for United States of America

asked on

how do i zero fill numeric values based on a dynamic number input by the user?

I have a table with string values and numeric values that I need to concatenate together.  The string value should go first then add 0's before the numeric value and concatenate to the string value.

maxbates table contains
prefix      varchar(255)
test

mysqltable contains

batesnum (numeric)    n_batesnum (varchar(255)
12345                          <null>
12346                          <null>
234567                        <null>
234568                        <null>
3456789                      <null>
3456790                      <null>

In a vb app, the user inputs that there should be 8 characters in the batesnum value so the final table
should look like this

mysqltable
batesnum   n_batesnum
12345         test00012345
12346         test00012346
234567       test00234567
234568       test00234568
3456789     test03456789
3456790     test03456790  


Thank you,

amhinkel
SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial