Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Collation for Latin and Cyrillic

Author  Topic 

hoonius
Starting Member

1 Post

Posted - 2009-11-19 : 07:13:09
Hi All

I have a database which has only had to store latin characters up until now

However, it now needs to store Russian characters and, although i was able to insert the data in Russian, the returned data is all ??????? so i'm thinking the collation is incorrect

Is there a collation mode which supports both characters sets? Do i even need to change the collation? Would changing the field type to nvarchar solve the problem maybe?

Any pointers would be most welcome :¬)

cheers

Tim

tecknical9
Starting Member

1 Post

Posted - 2010-02-23 : 16:48:18
quote:
Originally posted by hoonius

Hi All

I have a database which has only had to store latin characters up until now

However, it now needs to store Russian characters and, although i was able to insert the data in Russian, the returned data is all ??????? so i'm thinking the collation is incorrect

Is there a collation mode which supports both characters sets? Do i even need to change the collation? Would changing the field type to nvarchar solve the problem maybe?

Any pointers would be most welcome :¬)

cheers

Tim



Anwser by FKA
Sorry but answer is in French

to sum up the solution:
decalre your variable as NVARCHAR and then set the Value beginning with N. exemple write N'?????' not '?????'


j'ai trouvé la solution à ton problème de collation:

drop table tst_cyrilik

create table tst_cyrilik (strcyrilik nvarchar(20) not null )

insert into tst_cyrilik( strcyrilik ) values( N'?????' )

select * from tst_cyrilik

tu dois prendre en compte 2 paramètres:

1. mettre un N'ton caractère' (il est très important ce N)

2. déclarer ta variable qui va héberger le caractère cyrillique en NVARCHAR



Pas besoin de forcer ta collation à Cyrillic_General_CS_AS sur ta colonne si tu es effectivement en SQL_Latin1_General_CP1_CI_AS.



A titre d’exemple :

CREATE TABLE Datatable (
data NVARCHAR(50) COLLATE Cyrillic_General_CS_AS
)


INSERT INTO Datatable (data) VALUES (N'????? ??????????')
INSERT INTO Datatable (data) VALUES (N'?????????')

INSERT INTO Datatable (data) VALUES (N'???? ??????????? ?????????? ?????????')
INSERT INTO Datatable (data) VALUES (N'?????????')
INSERT INTO Datatable (data) VALUES (N'???????: ?????? (??????) — ???????')
INSERT INTO Datatable (data) VALUES (N'?????????')

select * from Datatable
Go to Top of Page
   

- Advertisement -