Skip to Content
author's profile photo Former Member
Former Member

Increasing domain length of a database field

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,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 11, 2014 at 07:41 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.