a003
b005
c993
d0433
9022
以上的数据中从第2位开始取数据,如果是零的话,就把零去掉,
结果便成为 ,3,5,993,433,22请大家帮忙,谢谢

解决方案 »

  1.   

    select cast(right(字段,lenght(字段)-1) as int)
      

  2.   

    declare @t table(code varchar(20))
    insert into @t select 'a003'
    union all select 'b005'
    union all select 'c993'
    union all select 'd0433'
    union all select '9022'select cast(right(code,lenght(code)-1) as int) from @t
      

  3.   

    declare @t table(code varchar(20))
    insert into @t select 'a003'
    union all select 'b005'
    union all select 'c993'
    union all select 'd0433'
    union all select '9022'select cast(right(code,len(code)-1) as int) as Code from @t/*
    Code
    ----------- 
    3
    5
    993
    433
    22
    */