INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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

(OP)
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
Lori

### 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.

Marc

### RE: how to make a number deafult length of 9

Solution:

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

Lenny

#### 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.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!