If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Padding while inserting into the table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-14-10, 02:48
pradeesh87 pradeesh87 is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
Padding while inserting into the table

Hi,

I am trying to load the data file into one table in db2.

the table have one of the column as amount. the length of that column is 10 digits but in the data file its different, so while loading tha file into the table I have to left pad the amount with 0s.

For example..

the data in the file for amount field is 435 and 2356 then after loading the data into that table the table should have 0000000435, 0000002356

can anyone help me on this?
Reply With Quote
  #2 (permalink)  
Old 10-14-10, 07:32
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
It is generally a bad idea to store numbers as strings in the database. I suggest you change the column data type to numeric and format the numbers upon selecting from the table.
Reply With Quote
Reply

Tags
padding

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On