问题
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
.
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.
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!
回答1:
There is no way to tell SQL Server that certain parts of a text are to be treated different from other parts.
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.
Your only option to do this would be to store the prefix ("Tussenvoegsel") in a separate column.
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.
来源:https://stackoverflow.com/questions/51936558/does-microsoft-sql-server-support-localized-name-sorting