vbNewbie
vbNewbie

Reputation: 3345

searching sql DB table for japanese terms

I have a table with columns that allow for different language formats (using nvarchar) and the problem is that when I try to search for these terms; particularly Japanese/Chinese terms, the typical select statement does not work

select * from jtable where searchterm = 'ろくでなし'

It will return 0 which is incorrect since it is definitely in the table. Someone mentioned using cast(....) but not sure how to do this.

Upvotes: 0

Views: 620

Answers (1)

gbn
gbn

Reputation: 432331

Need an N to make the string literal unicode.

select * from jtable where searchterm = N'ろくでなし'

Without the N the 'ろくでなし' is implicit varchar and is seen as '?????'

See my related answer about khmer text for examples of why: Khmer Unicode, English and Microsoft SQL Server 2008 results in questionmarks

Upvotes: 3

Related Questions