如何排序字母数字列 [英] How to sort alpha numeric column

查看:62
本文介绍了如何排序字母数字列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,



我想知道如何为我的varchar列应用排序。

我的数据库列数据类型是varchar记录看起来像(01,02,03,04,10,11,50,100,101 ...)而不是(01,02,03,04,10,11,100,101,50,...)。

如果我将数据表列设置为数字意味着值更改为(1,2,3,而不是01,02,03)。

i无法更改数据库列类型,因此我需要对此进行排序varchar列,格式为(00)。

帮助我们

Hi Team,

I want to know how to apply sorting for my varchar column.
my database column datatype is varchar the records looks like (01,02,03,04,10,11,50,100,101...) instead of (01,02,03,04,10,11,100,101,50,...).
if i set datatable column as number means the values changed like (1,2,,3 not 01,02,03).
i cant able to change the database column type so i need to sort this varchar column with format of ("00").
help me guys

推荐答案

select CONVERT(int,YourColumn) as bla  , YourColumn  
 from YourTable
 order by bla


这篇关于如何排序字母数字列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆