How to manage primary key while updating [migrated]
- by Subin Jacob
In the following table primaryKeyColumn is primary key.
To maintain the data history I always uses the values with WHERE condition(WHERE StatusColumn=1) And will set the StatusColumn to 0 if the data is edited (So that I could keep the previous data).
But the problem is, if I update it to 0 , I can't insert the same key to primarykeycolumn since the column validated for primary keys. How can I manage these kind of validations? what the mistake I did in this design?
primaryKeyColumn ValueColumn StatusColumn
---------------- ----------- ------------
2 Name1 1
3 Name2 1
4 Name3 0