select cast('00001234' as int)

解决方案 »

  1.   

    select cast(FieldName as int)
      

  2.   

    同意楼上,转换成整型就可以了。
    cast与convert都可以的select cast('0004' as int)
    select convert(int,'0004')  
    --返回 4
      

  3.   

    如果有不能转换为数值的字串,可用如下方法:select replace(ltrim(replace('00040s','0',' ')),' ','0')--返回'40s'
      

  4.   

    如果字段存的都是000 + 数字的话,
    使用alter改变改字段的类型肯定是最快的呀!
      

  5.   

    pjy(古虫) 的方法是怎样的啊?
    我没有见过!是怎么用的呢?