标签:rom sql cas order int sele -- 包含 char
--模拟数据
SELECT * INTO #temp FROM
(
SELECT 1 AS id, ‘C101‘ AS sort
UNION ALL
SELECT 2 AS id, ‘B101‘ AS sort
UNION ALL
SELECT 3 AS id, ‘101‘
UNION ALL
SELECT 4 AS id, ‘1101‘
UNION ALL
SELECT 5 AS id, ‘201‘
UNION ALL
SELECT 6 AS id, ‘风‘
UNION ALL
SELECT 7 AS id, ‘花‘
UNION ALL
SELECT 8 AS id, ‘雪‘
UNION ALL
SELECT 9 AS id, ‘月‘
) S
--查询排序
SELECT * FROM #temp ORDER BY RIGHT(REPLICATE(‘0‘,10)+CAST(sort AS VARCHAR(10)),10) ASC
标签:rom sql cas order int sele -- 包含 char
原文地址:https://www.cnblogs.com/xy0710/p/11394759.html