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: 

Overwriting a record with part of same primary key

Former Member
0 Kudos

Hello Everyone,

Could anyone please give a suggestion about how to overwrite the record with part of same primary key?

I have 5 key fields.

A1

A2

A3

A4

A5

I have to overwrite the record if A5 changes with same A1 A2 A3 A4.

I cannot take off A5 as part of primary key. If I use modify or insert, its creating a new record with the new A5. But I am still having the old record in the table (with old A5), which I don't want it to be there.

Thank you,

Rushi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

That's right.

u have to delete record from database table .....

then u can add a new record...

use delete <database_table> from table <internal_table>

7 REPLIES 7

JozsefSzikszai
Active Contributor
0 Kudos

hi,

logically, you have to delete the old record in a separate step!

hope this helps

ec

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

That's right. That is the normal behavior, so you would need to manually delete the old record either before of after your insert the new one.

Regards,

Rich Heilman

0 Kudos

Hello,

Thank you for all your replies.

Can I use "delete from 'table name' where" and then insert the new record?

Rushi

0 Kudos

WHERE won't work, you have to use: DELETE dbtab FROM wa

Former Member
0 Kudos

Try using UPDATE...if still doesnot work then first delete the record and then insert the record..

Subhankar
Active Contributor
0 Kudos

Hi,

One thing you can do, Make A5 as non key field (If possible). Then modify it.

If not possible delete the old record and insert a new record.

Former Member
0 Kudos

hi,

That's right.

u have to delete record from database table .....

then u can add a new record...

use delete <database_table> from table <internal_table>