Swap values for two rows in the same table in SQL Server
- by AmRoSH
I have table and I want to swap the values from two rows. I have the rows IDs of the two rows.
Is there any query to do that? Here is an example. Before the query I have this:
row1 : 1,2,3
row2 : 5,6,7
After the swap I want this:
row1 : 5,6,7
row2 : 1,2,3
I don't want write it in .NET code because I think an SQL query is easier than that.