What function to use to left pad a number with 0's

I have a total count being retrieved into a variable in a stored procedure.
Example the value of the variable is an INTEGER datatype with value as 99.... I need to change the value as a char and use it as 000099 and create a string with tis number and more numbers.

99 should be changed to 000099 in characters.
Who is Participating?
momi_sabagConnect With a Mentor Commented:
you can use

select right(digitis(your_column_name),6)
Dave FordConnect With a Mentor Software Developer / Database AdministratorCommented:

Momi's solution is BY FAR the easiest. Use it.

If you want something a little more flexible, you could use the to pad with any character:

select right(repeat('*', 6) || yourColumn,6)
... or ...
select right(repeat('0', 6) || yourColumn,6)

All Courses

From novice to tech pro — start learning today.