1

I have a series of tables that each have a dedicated column to a foreign language. Languages vary from Japanese, Thai, English, Italian, French, more than 20 in all.

All of these tables are set up with Latin Case Insensitive collation. DB works fine.

But now I am trying to query against the specific foreign language column of each table. Lets take Japanese for starters. I'd like a foreign language user to enter foreign text and find the record based on the foreign language column.

  DECLARE @myVar nvarchar(max);

  SET @myVar =  'エンジン ストップ リレー'      = 'Engine Stop Relay' in english

  Select *
  FROM tableJapanese
  WHERE langString = @myVar;

I have tried a multitude of collation combinations. I even copied the table and changed the collation of the column to Japanese_CI_AI and tried to query it that way.

None of these WHERE clauses work on either table/columm collation, when the column was Latin or Japanese...

WHERE lang_String collate Japanese_CI_AI = @myVar;
WHERE lang_String = @myVar collate Japanese_CI_AI;
WHERE lang_String collate Japanese_CI_AI = @myVar collate Japanese_CI_AI;

WHERE lang_String collate Japanese_CI_AI = @myVar;
WHERE lang_String = @myVar collate Japanese_CI_AI;
WHERE lang_String collate Japanese_CI_AI = @myVar collate Japanese_CI_AI;

I would like to leave the columns/database as Latin collation and code the queries for each language if possible.

This seems like one of those problems that if were a snake I'd been bitten already. Can anyone see what I am missing?

MSSQL Express 2008 R2

SOLUTION:

Add N in front of the field, it indicates unicode to SQL...

  Select *
  FROM tblLangJAP_test
  WHERE lang_String = N'エンジン ストップ リレー';

Works flawlessly.

Thanks,

4

1 に答える 1

2

フィールドの前にNを追加します。これは、SQLへのUnicodeを示します... Select * FROM tblLangJAP_test WHERE lang_String = N')

完璧に動作します。

于 2012-09-04T12:50:45.963 に答える