Sunday, March 25, 2012

Collation issue?

Hi,
I am having problems querying some czech letters (or maybe it is
inserting that fails?).
Here is the deal:
We have a web application that supports different languages. We have
stored the different messages to be displayed into a nvarchar column
with the SQL_Danish_Pref_CP1_CI_AS collation.
resource_ID
int
langID
int
data nvarchar(4000 )
Then I update the following row into the table:
update usr_data set data=3D'Dotazn=C3=ADk je vypln=C4=9Bn!' where langid=3D= 5 and
resource_id=3D7
When querying the updated value I get
resource_ID langID data
7 5 Dotazn=C3=ADk je vyplnen!
See the missing upside-down ^ over the letter e in the last word.
I have also tested this on collation Latin1_General_CI_AS and
Czech_CI_AS with the same result.
I created a new table with a nvarchar column with the above collation
and inserted the same text, but the result was the same.
What am I missing here?
Thanks,> Then I update the following row into the table:
> update usr_data set data='Dotazník je vyplnÄ?n!' where langid=5 and
> resource_id=7
For a Unicode constant, prefix the literal with N:
UPDATE dbo.usr_data
SET data = N'Dotazník je vyplnÄ?n!'
WHERE
langid = 5 AND
resource_id = 7
Note that Unicode allows all Unicode characters to be stored. The Unicode
collation affects only sorting and comparison.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"gurbao" <audunj@.gmail.com> wrote in message
news:1181645527.452234.163220@.x35g2000prf.googlegroups.com...
Hi,
I am having problems querying some czech letters (or maybe it is
inserting that fails?).
Here is the deal:
We have a web application that supports different languages. We have
stored the different messages to be displayed into a nvarchar column
with the SQL_Danish_Pref_CP1_CI_AS collation.
resource_ID
int
langID
int
data nvarchar(4000 )
Then I update the following row into the table:
update usr_data set data='Dotazník je vyplnÄ?n!' where langid=5 and
resource_id=7
When querying the updated value I get
resource_ID langID data
7 5 Dotazník je vyplnen!
See the missing upside-down ^ over the letter e in the last word.
I have also tested this on collation Latin1_General_CI_AS and
Czech_CI_AS with the same result.
I created a new table with a nvarchar column with the above collation
and inserted the same text, but the result was the same.
What am I missing here?
Thanks,|||Thanks a lot!
That did the trick.
Only thing I wonder now, is how I could forget :-)
Regards,
On Jun 12, 1:02=C2=A0pm, "Dan Guzman" <guzma...@.nospam-
online.sbcglobal.net> wrote:
> > Then I update the following row into the table:
> > update usr_data set data=3D'Dotazn=C3=ADk je vypln=C4=9Bn!' where langi=d=3D5 and
> > resource_id=3D7
> For a Unicode constant, prefix the literal with N:
> UPDATE dbo.usr_data
> SET data =3D N'Dotazn=C3=ADk je vypln=C4=9Bn!'
> WHERE
> =C2=A0 =C2=A0 langid =3D 5 AND
> =C2=A0 =C2=A0 resource_id =3D 7
> Note that Unicode allows all Unicode characters to be stored. =C2=A0The U=nicode
> collation affects only sorting and comparison.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "gurbao" <aud...@.gmail.com> wrote in message
> news:1181645527.452234.163220@.x35g2000prf.googlegroups.com...
> Hi,
> I am having problems querying some czech letters (or maybe it is
> inserting that fails?).
> Here is the deal:
> We have a web application that supports different languages. We have
> stored the different messages to be displayed into a nvarchar column
> with the SQL_Danish_Pref_CP1_CI_AS collation.
> resource_ID
> int
> langID
> int
> data =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nvarchar(4000 )
> Then I update the following row into the table:
> update usr_data set data=3D'Dotazn=C3=ADk je vypln=C4=9Bn!' where langid==3D5 and
> resource_id=3D7
> When querying the updated value I get
> resource_ID langID =C2=A0 =C2=A0 =C2=A0data
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 7 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5= Dotazn=C3=ADk je vyplnen!
> See the missing upside-down ^ over the letter e in the last word.
> I have also tested this on collation Latin1_General_CI_AS and
> Czech_CI_AS with the same result.
> I created a new table with a nvarchar column with the above collation
> and inserted the same text, but the result was the same.
> What am I missing here?
> Thanks,|||> Only thing I wonder now, is how I could forget :-)
I'm glad I was able to help. I think you'll remember the 'N' the next time
;-)
--
Dan Guzman
SQL Server MVP
"gurbao" <audunj@.gmail.com> wrote in message
news:1181646750.111306.272120@.z28g2000prd.googlegroups.com...
Thanks a lot!
That did the trick.
Only thing I wonder now, is how I could forget :-)
Regards,
On Jun 12, 1:02 pm, "Dan Guzman" <guzma...@.nospam-
online.sbcglobal.net> wrote:
> > Then I update the following row into the table:
> > update usr_data set data='Dotazník je vyplnÄ?n!' where langid=5 and
> > resource_id=7
> For a Unicode constant, prefix the literal with N:
> UPDATE dbo.usr_data
> SET data = N'Dotazník je vyplnÄ?n!'
> WHERE
> langid = 5 AND
> resource_id = 7
> Note that Unicode allows all Unicode characters to be stored. The Unicode
> collation affects only sorting and comparison.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "gurbao" <aud...@.gmail.com> wrote in message
> news:1181645527.452234.163220@.x35g2000prf.googlegroups.com...
> Hi,
> I am having problems querying some czech letters (or maybe it is
> inserting that fails?).
> Here is the deal:
> We have a web application that supports different languages. We have
> stored the different messages to be displayed into a nvarchar column
> with the SQL_Danish_Pref_CP1_CI_AS collation.
> resource_ID
> int
> langID
> int
> data nvarchar(4000 )
> Then I update the following row into the table:
> update usr_data set data='Dotazník je vyplnÄ?n!' where langid=5 and
> resource_id=7
> When querying the updated value I get
> resource_ID langID data
> 7 5 Dotazník je vyplnen!
> See the missing upside-down ^ over the letter e in the last word.
> I have also tested this on collation Latin1_General_CI_AS and
> Czech_CI_AS with the same result.
> I created a new table with a nvarchar column with the above collation
> and inserted the same text, but the result was the same.
> What am I missing here?
> Thanks,

No comments:

Post a Comment