Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Increasing domain length of a database field

Former Member
0 Kudos

Hello everyone,

I have a databsae field with multiple primary keys. So its a composite key.  For one of such fields I need to change the domain length.

presently it is CHAR10. I want to change it to CHAR12.

This table is already transported to the customer. It contains a lot of data.

I tried to make this change in a <test_table> in the internal system. I simply changed the doamin length from CHAR10 to CHAR12.

As a result,

data field :

    previous value : '1000000000'

    new value       : '1000000000  '     [ There is this two additional spaces which comes ]

I wanted to append additional zeroes to  the existing data rather than putting this two padding spaces.

Is there any way I can achieve it rather than writing a migration table report .

Thanks in advance for your inputs. Feel free to ask any other information if you require.

Thanks & Regards,

Rohit

1 REPLY 1

PeterJonker
Active Contributor
0 Kudos

You will have to write code for that. Naturally because a value of  1000000000 is a different value then 100000000000 or 001000000000 for that matter.

There is NO way to have this done automatically since the field is type CHAR.

If you declare your field as numeric in stead of char it might add the leading zeroes, but since this is already being used that can have many effects in programs which address this data element. That would be a great risk.

So my advise would be to write a migration program and also to backup your data before you execute this program, so you can always go back to the current situation.