How do I swap column values in sql server 2008?

后端 未结 8 579
春和景丽
春和景丽 2020-12-08 09:40

I have a table called Employee

 Eno     ename     AttributeValue      AttributeName  
 1       aa           a123             abc
 2       bbb          b123           


        
8条回答
  •  情歌与酒
    2020-12-08 09:56

    UPDATE employee
    SET AttributeValue = AttributeName, 
        AttributeName = AttributeValue
    

    However, unless both columns have the exact same definition, you risk losing information.

提交回复
热议问题