Adding a primary key

You can add a row with a new primary key value to a table using one of these methods:

  • You can insert a new row in the table (I prefix command) and then change the values in the new row to create the required primary key value.
  • You can repeat an existing row and then change the values in the new row to create the required primary key value.
    Note: If you use this method, you must change the new row (added immediately below the original row, and intensified), rather than the original row. The reason for this is that changing the original row instead of the new row results in FM/Db2 attempting to update the original row with the new primary key value. This change fails if the original row has dependent rows, and SQLCODE -531 results. FM/Db2 also reports a duplicate row error (SQLCODE -803) against the new row as it attempts to insert a new row, identical to the original row.

Related tasks

Related references