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: 

Addition of fields to database table and copying data from other field

Former Member
0 Kudos

Hi All,

I am having a database table where in I am having a column 'FIELD1'.

My requirement is that I want to add two more fields in the table 'FIELD2' and 'FIELD3'.

I then want to copy all the data in field1 to field2 and field3. then I want to delete the original field1.

for Ex.

lets say FIELD1 = 100.

now I want to add FIELD2 and FIELD3 in the table and make FIELD2 = 100 AND FIELD3 = 100. The FIELD1 will be deleted from table.

Please suggest the methods to do so.

It is urgent.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Gaurav,

I don't know of a way to delete a column programatically, and therefore you would need to do that step with a follow up transport.

The code to update field2 and field3 should be pretty straight forward.


Select * from mytable
   mytable-FIELD2 = mytable-FIELD3 = mytable-FIELD1.
   modify mytable.
endselect.

1 REPLY 1

Former Member
0 Kudos

Gaurav,

I don't know of a way to delete a column programatically, and therefore you would need to do that step with a follow up transport.

The code to update field2 and field3 should be pretty straight forward.


Select * from mytable
   mytable-FIELD2 = mytable-FIELD3 = mytable-FIELD1.
   modify mytable.
endselect.