vendredi 12 février 2016

SQLite Changing primary key value

Is there any way to change the value of the only unique identifier for a row in SQLite? Something like

if(ID == 5) ID = 4;

I tried

UPDATE Table SET ID = Value WHERE ID = DifferentValue

But it does not seem to do a trick. The reason for this is that I don't auto-increment IDs as I prefer them to be set by programme because I have different methods when ID is odd and ID is even and I might need to switch the IDs in case some entry gets deleted so to compress the numbers so they don't leave blank ID spaces between them.

Programme is written in C# if that helps.

EDIT: The column is NOT truly dedicated as a PK in the db, it is jut NOT NULL integer that I control myself on non-duplicates so that it can serve as a PK

Aucun commentaire:

Enregistrer un commentaire