Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe16.iad.POSTED!95f1e2f4!not-for-mail From: nilesh mantri Subject: Re: Prefix literal unicode strings with NFor example in the AdventureWorks sample Newsgroups: comp.databases.ms-sqlserver Reply-To: no.spam.tom7744@cox.net References: <2ssa04l13cqet0nvinqp11dar5qpeftupv@4ax.com> Message-ID: <201261555249usenet@terrranews.com> Lines: 80 X-Complaints-To: abuse@AltBinaries.com NNTP-Posting-Date: Fri, 15 Jun 2012 09:53:04 UTC Organization: http://www.AltBinaries.com - Uncensored, Un-logged, Secure. Date: Fri, 15 Jun 2012 09:53:04 GMT X-Received-Bytes: 2772 Xref: csiph.com comp.databases.ms-sqlserver:1126 I have same problem for executing hibernate query. If I Prefix literal unicode strings with 'N' in HQL query, it will give exception as --> org.hibernate.hql.ast.QuerySyntaxException: unexpected token: '?????????' Any help will be Appreciates. Thanks, Nilesh > On Tuesday, April 15, 2008 4:06 PM rowe_newsgroups wrote: > I apologize if this has been covered ad nauseum, but I did not 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 am 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] >> On Tuesday, April 15, 2008 11:36 PM Tom van Stiphout wrote: >> 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 is too late. >> >> -Tom. >>> On Wednesday, April 16, 2008 7:12 AM rowe_newsgroups wrote: >>> Ah, >>> >>> Thanks Tom, it is now working just as I hoped. Amazing how one >>> character makes all the difference! >>> >>> Thanks, >>> >>> Seth Rowe [MVP]