我正在研究一个以SQL Server为后端的现有系统。我们开始用多种语言(包括西里尔字符的俄语和其他欧洲语言)存储特设项目标题数据。我的问题是如何对这些数据进行排序,在不更改排序规则的情况下,根据需要更改排序顺序有哪些选择?我可以决定查询本身的排序规则吗?
下面是一个示例查询,我正在尝试查看:
SELECT STR FROM (
SELECT N'а01' AS STR UNION
SELECT N'б02' AS STR UNION
SELECT N'в03' AS STR UNION
SELECT N'г04' AS STR UNION
SELECT N'д05' AS STR UNION
SELECT N'е06' AS STR UNION
SELECT N'Ñ07' AS STR UNION
SELECT N'ж08' AS STR UNION
SELECT N'з09' AS STR UNION
SELECT N'и10' AS STR UNION
SELECT N'й11' AS STR UNION
SELECT N'к12' AS STR UNION
SELECT N'л13' AS STR UNION
SELECT N'м14' AS STR UNION
SELECT N'н15' AS STR UNION
SELECT N'о16' AS STR UNION
SELECT N'п17' AS STR UNION
SELECT N'Ñ18' AS STR UNION
SELECT N'Ñ19' AS STR UNION
SELECT N'Ñ20' AS STR UNION
SELECT N'Ñ21' AS STR UNION
SELECT N'Ñ22' AS STR UNION
SELECT N'Ñ
23' AS STR UNION
SELECT N'Ñ24' AS STR UNION
SELECT N'Ñ25' AS STR UNION
SELECT N'Ñ26' AS STR UNION
SELECT N'Ñ27' AS STR UNION
SELECT N'Ñ28' AS STR UNION
SELECT N'Ñ29' AS STR UNION
SELECT N'Ñ30' AS STR UNION
SELECT N'Ñ31' AS STR UNION
SELECT N'Ñ32' AS STR UNION
SELECT N'Ñ33' AS STR UNION
SELECT N'a34' AS STR UNION
SELECT N'b35' AS STR UNION
SELECT N'c36' AS STR UNION
SELECT N'd37' AS STR UNION
SELECT N'e38' AS STR UNION
SELECT N'f39' AS STR UNION
SELECT N'g40' AS STR UNION
SELECT N'h41' AS STR UNION
SELECT N'i42' AS STR UNION
SELECT N'j43' AS STR UNION
SELECT N'k44' AS STR UNION
SELECT N'l45' AS STR UNION
SELECT N'm46' AS STR UNION
SELECT N'n47' AS STR UNION
SELECT N'o48' AS STR UNION
SELECT N'p49' AS STR UNION
SELECT N'q50' AS STR UNION
SELECT N'r51' AS STR UNION
SELECT N's52' AS STR UNION
SELECT N't53' AS STR UNION
SELECT N'u54' AS STR UNION
SELECT N'v55' AS STR UNION
SELECT N'w56' AS STR UNION
SELECT N'x57' AS STR UNION
SELECT N'y58' AS STR UNION
SELECT N'z59' AS STR UNION
SELECT N'A60' AS STR UNION
SELECT N'B70' AS STR UNION
SELECT N'C71' AS STR UNION
SELECT N'D72' AS STR UNION
SELECT N'E73' AS STR UNION
SELECT N'F74' AS STR UNION
SELECT N'G75' AS STR UNION
SELECT N'H76' AS STR UNION
SELECT N'I77' AS STR UNION
SELECT N'J78' AS STR UNION
SELECT N'K79' AS STR UNION
SELECT N'L80' AS STR UNION
SELECT N'M81' AS STR UNION
SELECT N'N82' AS STR UNION
SELECT N'O83' AS STR UNION
SELECT N'P84' AS STR UNION
SELECT N'Q85' AS STR UNION
SELECT N'R86' AS STR UNION
SELECT N'S87' AS STR UNION
SELECT N'T88' AS STR UNION
SELECT N'U89' AS STR UNION
SELECT N'V90' AS STR UNION
SELECT N'W91' AS STR UNION
SELECT N'X92' AS STR UNION
SELECT N'Y93' AS STR UNION
SELECT N'Z94' AS STR
) AS SUBTABLE
ORDER BY STR ASC
我接到的命令是:
a34
A60
b35
B70
c36
C71
d37
D72
e38
E73
f39
F74
g40
G75
h41
H76
i42
I77
j43
J78
k44
K79
l45
L80
m46
M81
n47
N82
o48
O83
p49
P84
q50
Q85
r51
R86
s52
S87
t53
T88
u54
U89
v55
V90
w56
W91
x57
X92
y58
Y93
z59
Z94
а01
б02
в03
г04
д05
е06
Ñ07
ж08
з09
и10
й11
к12
л13
м14
н15
о16
п17
Ñ18
Ñ19
Ñ20
Ñ21
Ñ22
Ñ
23
Ñ24
Ñ25
Ñ26
Ñ27
Ñ28
Ñ29
Ñ30
Ñ31
Ñ32
Ñ33
看起来有些西里尔字符与它们的英语等价物相似,有没有办法将这些交错作为“a到z”的一部分?
SQL Server中还有哪些其他排序选项可用?
如果我不能在查询中这样做,那么在每列的基础上选择最可靠的排序规则是什么?