How to swap values without getting dup_val_on_index exception
kdwolfMay 22 2011 — edited May 23 2011My table has a primary key with the follow segments:
TV Channel Id
Schedule Date
Version Number.
Each TV Channel may have more than one planned schedule for a given schedule date.
Normally Version Number = 0 would be the one to be aired, but occasionally other versions may be aired instead.
A user may decide to swap between the versions, e.g. if for Channel Id = 1 and Schedule Date = 05/05/2011
there are two Version Numbers - 0 and 1, a user may decide to swap between them, so version 1 will now version 0 and version 0 - version 1.
What is the best way to perform such a change without causing the exception? Normally there could be up to 5 different versions for a same
channel / date combination, so it is not just to swap 0 with 1.
Thanks in advance