| Author |
how I can swap content of two fields in one table?
|
raminaa niilian
Ranch Hand
Joined: Jul 14, 2005
Posts: 550
|
|
Hi
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.
Thanks
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2350
|
|
try:
|
OCUP UML fundamental
ITIL foundation
|
 |
Himanshu Kansal
Ranch Hand
Joined: Jul 05, 2009
Posts: 257
|
|
if the above works, it is simply wonderful. In case it does not just think of your problem as that you want to rename the columns
|
Experience and talent are independent of age
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2350
|
|
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?
|
|
|