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.
Author |
Topic |
hoonius
Starting Member
1 Post |
Posted - 2009-11-19 : 07:13:09
|
Hi AllI have a database which has only had to store latin characters up until nowHowever, 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 incorrectIs 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 :¬)cheersTim |
|
tecknical9
Starting Member
1 Post |
Posted - 2010-02-23 : 16:48:18
|
quote: Originally posted by hoonius Hi AllI have a database which has only had to store latin characters up until nowHowever, 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 incorrectIs 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 :¬)cheersTim
Anwser by FKASorry but answer is in Frenchto 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_cyrilikcreate table tst_cyrilik (strcyrilik nvarchar(20) not null )insert into tst_cyrilik( strcyrilik ) values( N'?????' )select * from tst_cyriliktu 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 |
|
|
|
|
|