Billy Pang
tuxedo_man at hotmail.com
Fri Oct 29 19:35:23 CDT 2004
Hello:
I have a table that contains one column with the following six values:
a1
a2
a21
a10x
a2a
a10
Currently if that column is sorted, it is sorted this way:
a1
a10
a10x
a2
a21
a2a
But I want it to be sorted this way:
a1
a2
a2a
a10
a10x
a21
(note: a2a comes before a10, a21 goes after a10x, etc...ergo, letters come
before numbers, contrary to their ascii values)
Is it possible or is it a pipe dream? Below is copy of code.
Thanks in advance,
Billy
/* cut here */
use tempdb
create table #the_table(the_value varchar(10));
insert into #the_table(the_value) values('a1');
insert into #the_table(the_value) values('a2');
insert into #the_table(the_value) values('a21');
insert into #the_table(the_value) values('a10x');
insert into #the_table(the_value) values('a2a');
insert into #the_table(the_value) values('a10');
select * from #the_table order by the_value
drop table #the_table;
/* cut here */