有数据如下NUM
========
1
100103
2
3
1001
2001
100101
100102
10010201我想要排序成NUM
========
1
1001
100101
100102
10010201
100103
2
2001
3
========
1
100103
2
3
1001
2001
100101
100102
10010201我想要排序成NUM
========
1
1001
100101
100102
10010201
100103
2
2001
3
如果是字符型的
order by num如果是数值型的
order by cast(num as varchar)
insert into @t
select 1 union all
select 100103 union all
select 2 union all
select 3 union all
select 1001 union all
select 2001 union all
select 100101 union all
select 100102 union all
select 10010201 select * from @t order by cast(num as varchar)