all groups > sql server misc > april 2004 >
You're in the

sql server misc

group:

SQL Server Collation


SQL Server Collation kusmuk NO[at]SPAM reflected.org
4/26/2004 11:26:37 PM
sql server misc:
Hi All;

We have a database which is designed in Turkish collation. Widely,
its designed for that language and there is no way to turn it back.

But, remote database had been installed in English collation; which
collates all turkish characters with english ones. I have no idea
Windows Collation or SQL Server collation does it.

So, is there a way to change DEFAULT COLLATION to turkish in
vbdotnet, without changing any sql server options? IMHO there should
be a way to set it to turkish when SQL Connection initializes.

Note : I tried to change databases default collation to Turkish.
Seems its changed, but still collates to english.

Re: SQL Server Collation Erland Sommarskog
4/29/2004 10:15:28 PM
Alper Barkmaz (kusmuk@reflected.org) writes:
[quoted text, click to view]

No, there isn't.

[quoted text, click to view]

The default collation affects new tables, but existing tables were not
changed when you changed the database collation. You will need to
rebuild the database.


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
Re: SQL Server Collation kusmuk NO[at]SPAM reflected.org
4/30/2004 12:28:27 AM
[quoted text, click to view]


After many researches, we got a new point about this situation.
Current SQLServer DB Collation is set to Latin1_General, but data is
in it having Turkish characters, which is in codepage 1254 group.

So, when we tried to read data from tables; all data is fetched in
CodePage 1250 (or 1252 I do not remember exactly).

New question is : Is there a way to query SQL Server pretending like
its data is in codepage 1254? Or any REPLACE functions available for
Re: SQL Server Collation Erland Sommarskog
5/1/2004 10:29:49 PM
Alper Barkmaz (kusmuk@reflected.org) writes:
[quoted text, click to view]

I'm not really sure that I understand what you are trying to do, but
here is an example of what is possible:

CREATE TABLE nisse (a varchar(40) NOT NULL)
go
INSERT nisse (a) VALUES ('Alfons')
INSERT nisse (a) VALUES ('Åkermark')
INSERT nisse (a) VALUES ('Ärlig')
INSERT nisse (a) VALUES ('Betesmark')
INSERT nisse (a) VALUES ('Olofslund')
INSERT nisse (a) VALUES ('Önnestad')
INSERT nisse (a) VALUES ('Pamukkale')
INSERT nisse (a) VALUES ('Victor')
INSERT nisse (a) VALUES ('Urban')
INSERT nisse (a) VALUES ('Üsküdar')
INSERT nisse (a) VALUES ('Torrskodd')
go
SELECT * FROM nisse ORDER BY a COLLATE Finnish_Swedish_CS_AS
SELECT * FROM nisse ORDER BY a COLLATE German_Phonebook_CS_AS
SELECT * FROM nisse ORDER BY a COLLATE Turkish_CS_AS

But this only works within the given code page. If the database has the
collation Latin_General1, and you have byte 254 in a character, SQL
Server will handle it as LATIN SMALL LETTER THORN and not the character
which is there in CP1254.

Since I don't know your situation in detail, it is a little difficult
to say what you should do. If rebuilding that database is possible, you
should probably do it. If data does not match code page, you are in for
problems. You would need to use BCP to get the data out, and be sure
to specify -C RAW to avoid any conversion when you get data in and out.

--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
AddThis Social Bookmark Button