Showing posts with label japanese. Show all posts
Showing posts with label japanese. Show all posts

Tuesday, March 6, 2012

About unicode string comparison

Hi,
Can anyone here explain why the 2 Japanese strings are equal?
select case when N'あきよ' = N'ア_ヨ' then 'true' else 'false' end
select convert(varbinary,N'あきよ')
select convert(varbinary,N'ア_ヨ')
Thanks,
JamesJames,
They are equal under a Kana-insensitive collation. If you need to
distinguish them, use a Kana-sensitive collation. Equality of strings
is based on the rules of the collation in effect, not the strings' binary
representations.
select
case when N'あきよ' = N'ア_ヨ' collate Latin1_General_CS_AS_KS_WS
then 'true' else 'false'
end
This returns 'false'
Steve Kass
Drew University
James Ma wrote:

>Hi,
>Can anyone here explain why the 2 Japanese strings are equal?
>select case when N'あきよ' = N'ア_ヨ' then 'true' else 'false' end
>
>select convert(varbinary,N'あきよ')
>select convert(varbinary,N'ア_ヨ')
>Thanks,
>James
>|||Thank you so much.
"Steve Kass" wrote:

> James,
> They are equal under a Kana-insensitive collation. If you need to
> distinguish them, use a Kana-sensitive collation. Equality of strings
> is based on the rules of the collation in effect, not the strings' binary
> representations.
> select
> case when N'あきよ' = N'ア_ヨ' collate Latin1_General_CS_AS_KS_WS
> then 'true' else 'false'
> end
> This returns 'false'
> Steve Kass
> Drew University
> James Ma wrote:
>
>

Thursday, February 9, 2012

About building international applications in dotnet

Hi,

I am developing an application using C#.NET that accesses a remote database that that contains japanese characters.

My sample querry is strCommand = "SELECT * FROM table WHERE prodname = 'CR新海物語スペシャルM8'";

The result of querry displayed in the binded datagrid also contains other rows that has this prodname:

CRF湯けむり紀行SF-T
CRぱちんこハイサイVR1
CRホワイトエンジェルFS

etc.

Thanks in advance for your help.

You forgot to ask a question.
|||

Hi,

I am developing an application using C#.NET that accesses a remote database that that contains japanese characters.

My sample querry is strCommand = "SELECT * FROM table WHERE prodname = 'CR新海物語スペシャルM8'";

The result of the querry above that is displayed in the binded datagrid also contains other rows that has this prodname:

CRF湯けむり紀行SF-T
CRぱちんこハイサイVR1
CRホワイトエンジェルFS

etc.

Why does the command yields other records where the prodname field contains the 'CR' thing?

Sample querry result in a datagrid:

field1 field2 field3 prodname

a as er CR新海物語スペシャルM8

w aa ww CRF湯けむり紀行SF-T

ss dd ee CRぱちんこハイサイVR1

sdds ddd ee CR新海物語スペシャルM8

rf d5r wwe CRぱちんこハイサイVR1


Does this strange and redundant output has something to do with the Japanese characters contained in some fields

of the table?

Thanks in advance for your help.


|||Try with the correct nvarchar syntax:

SELECT * FROM table WHERE prodname = N'CR新海物語スペシャルM8'