Ordinarily I'd say left pad the numerics with SPACEs then sort, but SQL Server doesn't appear to have a PAD function? :wtf: I thought Oracle did. What Database system are you using? Some ideas for SQL Server:
select * from PadTest order by
REPLICATE(' ',8-LEN(X))+X
or
select * from PadTest order by
case ISNUMERIC(X)
when 1 then REPLICATE(' ',8-LEN(X))+X
else X end
modified on Friday, March 7, 2008 12:57 PM