Is there an easy way to swap content of two fields (sn and ssn) in a table with hundreds of rows?
I insert the content of those field by mistake. all sn values are stored under ssn and all ssn values are stored under sn.
Himanshu Kansal wrote:if the above works, it is simply wonderful.
It is, isn't it?
It works because your database will first resolve the value of sn and snn , before writing the new values.
just the same as update a_table set x = x + 1 increments column x. It reads the value of column x, increments it with 1, then writes that value to column x.
subject: how I can swap content of two fields in one table?