Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Problems with unicode Expand / Collapse
Author
Message
Posted Wednesday, October 31, 2012 5:07 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, July 21, 2014 4:54 AM
Points: 70, Visits: 185
I'm having a problem inserting a value into a varchar datatype field,

the value I'm trying to update a value in a column top 'vič' but when its updated it removes the accent above the c however in the same column there is a value š and the s retains its accent.

Can anyone explain why, I know I can convert the column to nvarchar and this will sort the problem but i'm confused why one is accepted the other isn't.

Also if I convert a Varchar datatype column to nvarchar would that alter any of the text at all.

Post #1379243
Posted Wednesday, October 31, 2012 5:21 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, July 25, 2014 9:12 AM
Points: 5,142, Visits: 4,930
All down to the code page and ASCII conversion.

select ASCII('š')
select ASCII('č')

The first returns ASCII code 154 which is the correct code for that character, but the latter returns ASCII code 99 which is for lowercase C.

I am guessing that your collation is set to a latin collation and therefore it is converting č to c as č is not a latin ASCII character.





Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1379250
Posted Wednesday, October 31, 2012 5:33 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, July 21, 2014 4:54 AM
Points: 70, Visits: 185
Correct its just taking the database collation of Latin_General_CI_AS,

is there anything which I can do so this value could be updated or would it be a case of changing the collation at a column level or altering it to nvarchar.

Thanks for the help
Post #1379253
Posted Wednesday, October 31, 2012 5:57 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, July 25, 2014 9:12 AM
Points: 5,142, Visits: 4,930
The only way would be to change the column to NVARCHAR, collation changes may work but then you introduce a whole host of potential problems as certain characters will change making other updates fail.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1379265
Posted Wednesday, October 31, 2012 6:02 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, July 21, 2014 4:54 AM
Points: 70, Visits: 185
Thanks thats what i'm thinking, never been the most knowledgeable on Collations so this could prove quite catastrophic if I start messing around when really its not required
Post #1379267
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse