sql将varchar类型转换为Int类型排序

来源:互联网 发布:手机制作个人简历软件 编辑:程序博客网 时间:2024/05/18 03:11
select * from Tb

 where 1=1 and  IsNumeric(Tb.a) = 1   order by cast(Tb.a as int) asc


IsNumeric(Tb.a) = 1 ---->筛选字段a能转换为int类型的数据
 


order by cast(Tb.a as int) asc ------->将a转换为int类型进行排序

0 0
原创粉丝点击