473,414 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Query Japanese Text in an NVarChar?

I apologize if this has been covered ad nauseum, but I didn't see it
in my search.

Basically, in an nvarchar(150) column (called "Phrase" in the below
samples) I store both english text as well as japanese (the table is
for translations). What I'm having trouble with is querying the table
by the NVarChar field.

This works fine:

//////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = 'Home'
//////////////

But when I try with japanese, nothing is returned:

/////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = '$B:F2A3J(B'
/////////////

I thought that the problem might be a conversion issue, so I tried the
following with no success:

/////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = CONVERT(NVARCHAR, '$B:F2A3J(B')
/////////////

Any help you can offer is appreciated!

Thanks,

Seth Rowe [MVP]
Jun 27 '08 #1
2 7068
On Tue, 15 Apr 2008 13:06:19 -0700 (PDT), rowe_newsgroups
<ro********@yahoo.comwrote:

Prefix literal unicode strings with N
For example in the AdventureWorks sample db:
select * from Person.Contact
where FirstName = N'???'

(I had used Character Map to select some Japanese character and use it
for a FirstName)

Unsure why CAST or CONVERT does not work. I would have expected the
same. Most likely following the rules of precedence your unicode is
first converted to ansi, then CONVERTed to unicode but by that time
it's too late.

-Tom.

>I apologize if this has been covered ad nauseum, but I didn't see it
in my search.

Basically, in an nvarchar(150) column (called "Phrase" in the below
samples) I store both english text as well as japanese (the table is
for translations). What I'm having trouble with is querying the table
by the NVarChar field.

This works fine:

//////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = 'Home'
//////////////

But when I try with japanese, nothing is returned:

/////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = '???'
/////////////

I thought that the problem might be a conversion issue, so I tried the
following with no success:

/////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = CONVERT(NVARCHAR, '???')
/////////////

Any help you can offer is appreciated!

Thanks,

Seth Rowe [MVP]
Jun 27 '08 #2
On Apr 15, 11:36 pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On Tue, 15 Apr 2008 13:06:19 -0700 (PDT), rowe_newsgroups

<rowe_em...@yahoo.comwrote:

Prefix literal unicode strings with N
For example in the AdventureWorks sample db:
select * from Person.Contact
where FirstName = N'???'

(I had used Character Map to select some Japanese character and use it
for a FirstName)

Unsure why CAST or CONVERT does not work. I would have expected the
same. Most likely following the rules of precedence your unicode is
first converted to ansi, then CONVERTed to unicode but by that time
it's too late.

-Tom.
I apologize if this has been covered ad nauseum, but I didn't see it
in my search.
Basically, in an nvarchar(150) column (called "Phrase" in the below
samples) I store both english text as well as japanese (the table is
for translations). What I'm having trouble with is querying the table
by the NVarChar field.
This works fine:
//////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = 'Home'
//////////////
But when I try with japanese, nothing is returned:
/////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = '???'
/////////////
I thought that the problem might be a conversion issue, so I tried the
following with no success:
/////////////
SELECT *
FROM tbl_ShortPhrases
WHERE Phrase = CONVERT(NVARCHAR, '???')
/////////////
Any help you can offer is appreciated!
Thanks,
Seth Rowe [MVP]
Ah,

Thanks Tom, it's now working just as I hoped. Amazing how one
character makes all the difference!

Thanks,

Seth Rowe [MVP]
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tracey | last post by:
Hi there, I want to search Japanese characters with Full Text search function. I created a table (tbSearch) for Full-text search on SQL 2000, English Win2k Server. The table contains 4 fields,...
1
by: GPenn | last post by:
SQL 2000, latest SP. We currently have the need to store data from a UTF-8 application in multiple languages in a single database. Our findings thus far support the fact that single-byte and...
2
by: Emilio Perez | last post by:
Hi, I'm trying to read a varchar(50) field writed in Japanese using this sentence: is = rset.getBinaryStream(num); at that sentence the JDBC driver shows the following error: ...
8
by: Daniel | last post by:
I'm trying to make a site work for japanese characters. It works fine except for the alerts in javascript. The characters are stored in unicode, as this; 'コミック全巻配' Those unicode characters...
2
by: Indra Heckenbach | last post by:
I have recently come across an unusual behavior with Postgres 7.3.4 on a Linux RH 9 system. My database has encoding set to "UNICODE", and the table includes Japanese text. I'm trying to issue a...
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
1
by: bjs | last post by:
I am using MS SQL Server 2000 and 2005, IIS 5,0 and ASP. I am able to display data that has been selected from a Unicode column in the database in all languages except Japanese (I get question...
1
by: suganya | last post by:
I have the 2 sql tables DoctorMaster DRID nvarchar(50) FirstName nvarchar(100) LastName nvarchar(100) Gender bit Address1 nvarchar(255) Address2 nvarchar(255)
9
by: leebridgewater | last post by:
Hello Group, I'm new to SQL sever but I have managed to create a SQL based online application and I just have a question that I'm sure someone here will be able to help me with. I have a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.