--直接用计算列alter table 表 add sFee as cast(case when charindex('.',Fee)=0 then cast(Fee as int) else cast(Fee as decimal(10,2)) end as varchar(20))

解决方案 »

  1.   

    第一个问题用update语句可以解决吗??请高手指点!学习,关注……
      

  2.   

    老大实际上已经写出来了第一个的答案了。Update 表 Set sFee=cast(case when charindex('.',Fee)=0 then cast(Fee as int) else cast(Fee as decimal(10,2)) end as varchar(20))
      

  3.   

    实际上用下面的就可以解决第一个问题了
    set quoted_identifier on
    go
    -- 当你表的id是identity时用set identity_insert
    set identity_insert "新表" on
    go
    insert into 新表(id,company,fee)
    select id,company,sfee
    from 旧表
    go
    set identity_insert "新表" off
    go
    set quoted_identifier on
    go
    至于第二个问题用触发器就可以了
      

  4.   

    第一个问题:update table set sfree=free(select free convert(varchar(20),free) )