RT
有一张数据库表,里面有字段A(float)和字段B(float),我需要将字段A这一列的数据内容和字段B的内容替换,请问有没有什么好方法?3Q

解决方案 »

  1.   

    --记录如下:
    if object_id('tb') is not null drop table tb
    go
    create table tb(a float,b float)
    insert tb
    select 1.1 ,2.0 union all
    select 1.2 ,2.2 union all
    select 1.3 ,2.1 
    goupdate tb set A=B,B=Aselect * from tb/**
    a                                                     b                                                     
    ----------------------------------------------------- ----------------------------------------------------- 
    2.0                                                   1.1000000000000001
    2.2000000000000002                                    1.2
    2.1000000000000001                                    1.3(所影响的行数为 3 行)
    */