how do you modify the value of the primary key of a record?

kenyokenyo Member Posts: 28
So whenever i try a MODIFY i get the error " "Table.Field" 'NEW_VALUE' does not exist " seems like it tries to find the record with the new primary key value which obviously doesn't exist yet in the table... so how am i supposed to change the value of the primary key field then? Do i have to delete the old row and insert a new one? seems weird to me.

Best Answer

Answers

  • kenyokenyo Member Posts: 28
    oh thank you , wasn't aware of that
  • serdarulutasserdarulutas Member Posts: 48
    Sometimes RENAME took long time. I have had success with:

    NewRec = OldRec
    OldRec.Delete;
    NewRec.PrimaryKey = NewValue
    NewRec.Insert;
  • ShaiHuludShaiHulud Member Posts: 128
    Sometimes RENAME took long time. I have had success with:

    NewRec = OldRec
    OldRec.Delete;
    NewRec.PrimaryKey = NewValue
    NewRec.Insert;

    There's a reason it "took long time" - it also needs to look up all related records (where Table Relation is pointing to the field you're changing) and modify values there as well. Imagine renaming Country or Currency without changing all the instances of them on related tables - it would be chaos!
    Arturas Kulsinskas
    NaviLogic

    All opinions expressed are my own and are not reflective of my employer
Sign In or Register to comment.