Declare @Sampletable as Table (Col1 varchar(5))
insert into @Sampletable
(Col1)
values ('a1'),('a10'),('a2'),('a3')
;With Cte
as
(
select Col1,Cast( SUBSTRING(Col1, 2, len(Col1)) as int) as Rnk
from @Sampletable
)
Select Col1 from Cte
order by Rnk asc
1条答案
按热度按时间46qrfjad1#
你可以尝试下面的代码作为查询调整的一部分。从字符串中分割数字是实现你的结果的基本步骤。