My table student is as follows:
Name | Id |
---|---|
Dave | 3414 |
Bob | 2861 |
The ID is the primary key value that has a unique constraint. I'm trying to swap the two primary key values, so Bob's ID is 3414 and Dave's ID is 2861. What's the quickest way to do this?
UPDATE student SET Id=2861 WHERE Id=3414;
UPDATE student SET Id=3414 WHERE Id=2861;
These two statements won't work as it will create duplicate primary keys.