select * from tb_test order by left(ac,len(ac)-1) asc

解决方案 »

  1.   

    select * from tb_test order by Convert(float,replace(ac,'%','')) asc
      

  2.   

    create table temp (A int,  B int, C varchar(10))
    insert temp 
    select 10,  3,  '4.5%' union all
    select 31,  9,  '3.2%' union all
    select 12,  8,  '2.1%'
    select * from temp order by left(c,len(c)-1) asc
      

  3.   

    将 nvarchar 值 '82.5%' 转换为数据类型为 int 的列时发生语法错误。
    格式该怎么转换呢
      

  4.   

    可以起作用啊declare @tb_test table(ac varchar(10))
    insert into @tb_test
    select '52.2%'
    union select '65.4%'
    union select '54.8%'select * from @tb_test order by ac asc
      

  5.   

    select * from tb_test order by Convert(numeric(9,2),replace(ac,'%','')) asc
      

  6.   

    select * from tb_test order by Cast(replace(ac,'%','') as numeric(9,2)) asc