Link to home
Start Free TrialLog in
Avatar of cossy74
cossy74

asked on

Convert int to string problem

Hi,

How do i convert an int to a string with prefix zeros.

For example convert the number 5 to the string '0000005'?
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

SELECT MyInt, RIGHT('0000000' + CONVERT(varchar, MyInt), 7) AS LeadingZeroes
FROM SomeTable
ASKER CERTIFIED SOLUTION
Avatar of avalenzuela
avalenzuela
Flag of Mexico 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