2

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

Lou
  • 2,200
  • 2
  • 33
  • 66

1 Answers1

2

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.

Lou
  • 2,200
  • 2
  • 33
  • 66