467,879 Members | 1,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,879 developers. It's quick & easy.

Sorting Numeric + Alpha Sorting

Hi,

I am using MS-SQL 2000. I had a varchar column with data formated as Numeric portion + Alpha portion.

Id
----
1
2AA
2DF
2AB
22A
444CD
11


etc..

I like to sort the column first with the numeric portion then with the alpha portion like follows.

1
2AA
2AB
2DF
11
22A
444CD

Regards,
Shijith
Nov 8 '07 #1
  • viewed: 2094
Share:
1 Reply
amitpatel66
Expert 2GB
Hi,

I am using MS-SQL 2000. I had a varchar column with data formated as Numeric portion + Alpha portion.

Id
----
1
2AA
2DF
2AB
22A
444CD
11


etc..

I like to sort the column first with the numeric portion then with the alpha portion like follows.

1
2AA
2AB
2DF
11
22A
444CD

Regards,
Shijith
Did you try a ORDER BY <column name>
the order by generally happens based on the ascii value of the alphabets.
A - 65 followed by B,C,D etc.

Could you please POST the output of the ORDER BY query here?
Nov 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Federico G. Babelis | last post: by
3 posts views Thread by success_ny | last post: by
8 posts views Thread by Saputra | last post: by
6 posts views Thread by Chuck M | last post: by
1 post views Thread by caldera | last post: by
5 posts views Thread by jrod11 | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.