日期:2014-05-18  浏览次数:20562 次

如何让SQLServer的id按照数字大小顺序排序
我的id从1到20,可是超过了SQLServer的默认排序这样的
1
10
11
12
.
.
.
19
2
3
4
5
6
7
请问如何才能让排序成为这样
1
2
3
4
5
6
7
8
9
10
11
.
.
.
排序规则选哪条?

------解决方案--------------------
select * from tb order by cast(id as int)
------解决方案--------------------
id 改為int 型
------解决方案--------------------
这样是查询出来是按照大小排列了,但在数据库中怎么搞
------解决方案--------------------
select * from tb order by cast(id as int)