问题描述
我最近在搜索包含日语文本的表时遇到了一个MS Access查询问题.日语有两个字母,平假名和片假名,具有相同的声音值,但字符不同.例如,あ(hiragana)和ア(片假名)都发音为'a'.对于我的SELECT
查询,这两个字符需要区别对待,但是当我运行以下查询时:
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]="あ"
它在我的Keyword
表中返回两个值both和ア(出于我的目的,行为不正确.)
It returns two values in my Keyword
table, both あ and ア (incorrect behaviour for my purposes.)
我已经找到了解决方法,以确保在SELECT
查询中对这两个字符进行区别对待,并希望将其发布在此处以供将来参考,以防其他人在MS Access中使用日语字符
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
推荐答案
我找到的解决方案是在WHERE
子句中使用StrComp
进行二进制比较.这样可以正确区分平假名和片假名,如:
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.
这篇关于MS Access查询不使用标准的相等运算符区分平假名和片假名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!