例如:   字段WG01=010  我想另WG02自动截取该字段为 WG02=10 就是不要前面的0...

解决方案 »

  1.   

    --如果全部是整型数字字符:
    update 表 set WG01=ltrim(cast(WG01 as int))--否则
    while exists (select 1 from 表 where left(WG01,1)='0')
    update 表 set WG01=right(WG01,len(WG01)-1) where left(WG01,1)='0'
      

  2.   

    update oa_data.sysdba.jnmt set wg85=(wg55+'-'+wg56+'('+wg57+')') where wg02 = '照片档案' and wg57 not like '%.%'这是一个语句  它把3个字段合并成了一个现在我想 WG56  和 WG57 2个字段都能做到上面说的功能  应该怎么改  1楼的语法是正确的  可是我不知道怎么加进这个语句.
      

  3.   


    update   oa_data.sysdba.jnmt   set   wg85=(right(wg55,2)+ '- '+right(wg56,2)+ '( '+wg57+ ') ')   where   wg02   =   '照片档案 '   and   wg57   not   like   '%.% ' 
      

  4.   

    update oa_data.sysdba.jnmt set wg85=(wg55+'-'+ltrim(cast(wg56 as int))+'('+ltrim(cast(wg57 as int))+')') where wg02 = '照片档案' and wg57 not like '%.%'这个搞定了.... 谢谢....