MS Access Query does not differentiate hiragana and katakana with standard equality operator

牧云@^-^@ 提交于 2020-01-21 09:44:17

问题


I recently ran into a problem with an MS Access query where I was searching a table containing Japanese text. Japanese has two alphabets, hiragana and katakana, with the same sound value, but different characters. For example, あ (hiragana) and ア (katakana) are both pronounced as 'a'. These two characters need to be treated as distinct for my SELECT query, but when I run the following query:

SELECT [KeywordID] FROM [Keyword] WHERE [Keyword].[Keyword]="あ"

It returns two values in my Keyword table, both あ and ア (incorrect behaviour for my purposes.)

I've figured out the workaround to ensure that these two characters are treated distinctly in SELECT queries, and wanted to post this here for future reference in case anyone else is working with Japanese characters in MS Access


回答1:


The solution I've found is to use StrComp in the WHERE clause to do a binary comparison. This will correctly differentiate hiragana and katakana, as in:

SELECT [KeywordID], [Keyword] FROM [Keyword] WHERE StrComp([Keyword].[Keyword], "あ", 0)=0

This returns one record, which is what I need.



来源:https://stackoverflow.com/questions/59343193/ms-access-query-does-not-differentiate-hiragana-and-katakana-with-standard-equal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!