Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


how to make a number deafult length of 9

how to make a number deafult length of 9

Friends I have a number and I am converting this to chat to conc with other stirnf field.

But the when i convert the number it strips of 0's before number

suppose number is 001234598 when i convert it to string it strips of 00 and gives me 1234598, any way to fix this?. THanks in advance

RE: how to make a number deafult length of 9

001234598 looks pretty much like a string to me..

Ties Blom

RE: how to make a number deafult length of 9

Hi Lori,
It depends on what the format of the column is that you are looking at as 'numeric'. In DB2 numeric has two flavours - Integer and Decimal and to get the leading zeroes when converting to a string, you need different functions.

If the column is an integer use DIGITS(colname) whereas if the column is decimal use CHAR(colname).

Hope this helps.


RE: how to make a number deafult length of 9


select right(digits(your_integer), 9)
from sysibm.sysdummy1


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close