SQL Server 排序规则未按我想要的方式排序
我正在与一小部分欧洲公司合作,这些公司应该按特定顺序排序。我尝试过的 SQL 排序规则都不能完全完成这项工作...
Finnish_Swedish_CI_AS
正确排序 Å、Å 和 Ö,但认为 Y 和 Ü 相同。
Latin1_General_CI_AS
对 Y 和 Ü 进行正确排序,但认为 Å 和 A 相同,依此类推。
我想要的是一个排序如下的列表:
- Company AB, Borlänge
- Company AB, Stockholm
- Company AB, Älvsjö (与瑞典语正确,但在拉丁语中排序为“...Alvsjo”)
- Company OÜ, Otepää (与拉丁语正确,但排序为“Company OY...”(瑞典语)
- Company OY、Mikkeli
- Company OY、Saavonlinna
似乎没有任何特定的排序规则可以解决问题。我可以以某种方式强制对特定列进行特定的排序规则/排序吗?还有其他提示可以解决这个问题吗?
I'm working with a small list of european companies, which is supposed to be sorted in a particular order. None of the SQL collations I've tried does the job fully...
Finnish_Swedish_CI_AS
Sorts Å, Ä and Ö correctly but thinks that Y and Ü are the same.
Latin1_General_CI_AS
Sorts Y and Ü correctly but thinks Å and A are the same, and so on.
What I want is a list sorted like:
- Company AB, Borlänge
- Company AB, Stockholm
- Company AB, Älvsjö (Correct with Swedish, but sorts as "...Alvsjo" in Latin)
- Company OÜ, Otepää (Correct with Latin, but sorts as "Company OY..." in Swedish)
- Company OY, Mikkeli
- Company OY, Saavonlinna
There don't seem to be any particular collation that does the trick. Can I somehow force specific collation/sorting for a specific column? Any other hints to get this right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个操作只能使用一个排序规则。如果您想混合文化,则必须存储名称的规范化版本以用于排序。
Company OÜ, Otepää
的规范化版本将为Company OU, Otepää
,这样您就可以将Ü
视为不是Y
。You can only use a single collation for each operation. If you want to mix cultures, you would have to store a normalised version of the name to use for sorting.
The normalised version for
Company OÜ, Otepää
would beCompany OU, Otepää
so that you could treatÜ
as if it's not anY
.