问题描述
我想知道Microsoft SQL Server是否支持基于本地化首选项的排序.我看到他们在 https://technet.microsoft.com/zh-cn/library/cc835499(v=sql.110).aspx 列出了如何根据语言规范比较字符串.但是我注意到英语和荷兰语的比较都使用Latin1_General_CI_AS
.
I'm wondering if Microsoft SQL Server supports sorting based on localization preferences. I see they have a page at https://technet.microsoft.com/en-us/library/cc835499(v=sql.110).aspx which lists how strings are compared based on the norms of the language. But I notice that the English and Dutch comparison both use Latin1_General_CI_AS
.
问题出在荷兰,许多人的姓氏都带有 tussenvoegsel .因此,我相信De Jong
的姓氏在按升序排序时会在Van Beethoven
之后.
The problem is in the Netherlands many have the last name with a tussenvoegsel. So I believe the last name of De Jong
would come after Van Beethoven
when sorting in ascending order.
我的理解是Microsoft SQL Server不支持此用例,但我不确定100%.想知道其他人是否有不同的经历.谢谢!
My understanding is the Microsoft SQL Server does not support this use case but I am not 100% sure. Wondering if anyone else had a different experience. Thanks!
推荐答案
没有办法告诉SQL Server文本的某些部分应与其他部分区别对待.
There is no way to tell SQL Server that certain parts of a text are to be treated different from other parts.
SQL Server知道并理解基于基于字符的的排序顺序(排序规则),例如 é
应该按照 e
进行排序.但是绝不能忽略基于单词和/或位置的,例如 Van
.
SQL Server knows and understands character-based sort orders (collations), e.g. é
should be sorted as if it were e
. But never word- and/or position-based, like Van
should be ignored if it is followed by something.
前缀可以包含多个单词,例如范德"和范特"也很常见,并且到目前为止,还不是全部.因此,按照某种内置规则正确"执行此操作将非常复杂.
Prefixes can have more than 1 word, e.g. "Van der" and "Van 't" are also quite common, and that is not all by far. So doing it 'right' by some kind of built-in rule would be a very complicated job.
您唯一的选择是将前缀("Tussenvoegsel")存储在单独的列中.
Your only option to do this would be to store the prefix ("Tussenvoegsel") in a separate column.
维基百科提到在荷兰通常使用单独的"Tussenvoegsel"列-同时它提到在比利时的荷兰语地区这种情况并不常见,因此您甚至需要了解自己的听众.
Wikipedia mentions that using a separate 'Tussenvoegsel' column is commonly done in The Netherlands - while at the same time it mentions that this is not commonly done in the Dutch-speaking parts of Belgium, so you need even be aware of your audience.
这篇关于Microsoft SQL Server是否支持本地化名称排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!