I am trying to increment the primary integer key field (_id) of an Android SQLite database table by 1 for all records with initial _id values greater than 21.
I have tried the following:
UPDATE tableName SET _id = _id+1 WHERE _id > 21
But upon completing the first update to the table (changing 22 to 23), there are 2 records with _id = 23. This creates an error. Is there a way to avoid the problem by running this process from the last record to the first as opposed to starting from the top?
Aucun commentaire:
Enregistrer un commentaire