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: 

Table entry becomes null when field name is updated using database utility

0 Kudos

Hello,

I created a table in se11. I added entries to the table but after some time i changed a field name. So to activate the table i go to database utility and activate it with option persist data.

But strangely the data in the field becomes null after the change.

The table fields are provided in below screenshot

I make the changes to the field emp_address to EMP_ADDRESS1. The new output from se16 is below.

Can anyone tell why this is happening?

1 ACCEPTED SOLUTION

former_member182550
Active Contributor

Strange ? No I don't think so. You removed EMP_ADDRESS and added EMP_ADDRESS1. The DB Utility recognises fields by name when saving data, not by position so since EMP_ADDRESS1 is not the same as EMP_ADDRESS your data was not preserved.

Rich

6 REPLIES 6

former_member182550
Active Contributor

Strange ? No I don't think so. You removed EMP_ADDRESS and added EMP_ADDRESS1. The DB Utility recognises fields by name when saving data, not by position so since EMP_ADDRESS1 is not the same as EMP_ADDRESS your data was not preserved.

Rich

  • @joby chacko i.e. your data is now lost forever.
  • So to rename a column emp_address to emp_address1, you should:
  • 1) add a new column emp_address1 and keep the old one (emp_address)
  • 2) activate the table
  • 3) Via any SQL editor, do : "update ZYOURTABLE set emp_address1 = emp_address"
  • 4) delete the column emp_address
  • 5) activate the table via the database utility.

0 Kudos

thanks Richard.

So it is an expected behaviour.

Is there a way to keep the data as it is and change the column name?

Richard gives you the correct answer ==> you should have choose his answer as the best answer

0 Kudos

I second Chaouki Akir !

sandra.rossi Thank you. I understood it now.