column change



IBM's flagship relational database management system

column change

Postby makkena » Wed Jun 01, 2011 8:30 am

I had a requirement to change column of a table from integer to char.The table has data.can any one pls tell the steps to do that.Data should be retained.
makkena
 
Posts: 9
Joined: Wed Mar 16, 2011 2:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: column change

Postby dick scherrer » Wed Jun 01, 2011 8:36 am

Hello,

Unload the data, make the column definition change, reformat the unloaded data to the proper format data, load the data.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: column change

Postby makkena » Wed Jun 01, 2011 8:42 am

Thanks for the reply.I tried that.The data is not gtting loaded.facing the below error.

DSNU390I -D820 151 06:06:10.78 DSNURWUF - INVALID CONVERSION FOR FIELD - ACCOUNT_NBR

151 06:06:10.80 DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8
makkena
 
Posts: 9
Joined: Wed Mar 16, 2011 2:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: column change

Postby makkena » Wed Jun 01, 2011 8:44 am

Sorry..i didnot format the data.Could you please let me know how to format the data.
makkena
 
Posts: 9
Joined: Wed Mar 16, 2011 2:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: column change

Postby dick scherrer » Wed Jun 01, 2011 9:19 am

Hello,

Read the unloaded data with the old format data and write a new file with the data formatted to match the new column definition.

One way to do this would be to use your sort product. Another would be to write a little bit of actual code.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: column change

Postby GuyC » Wed Jun 01, 2011 1:02 pm

You could have unloaded char(int_col1). Sort is the way to go now I guess.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post