Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server multi language data support

How do you setup a SQL Server 2005 DBMS, so that you can store data in different languages?

My exact problem is this: in SQL Server Management Studio I'm writing an insert statement which contains German Umlauts. Text is successfully saved but reading the same value results in text without Umlaut.

Consider that I have to support 4 languages: English, German, Greek & Russian (I don't want to think what I will face with the Russian text).

The DBMS is now setup with Greek collation (to support Greek).

Does this cause any problem??

Any hints??

like image 351
Savvas Sopiadis Avatar asked Jan 06 '10 23:01

Savvas Sopiadis


2 Answers

You need to use nvarchar data type for strings ( http://msdn.microsoft.com/en-us/library/ms186939.aspx ) and you also need to precede all unicode strings with N ( http://support.microsoft.com/kb/239530 ).

When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data". The "N" prefix stands for National Language in the SQL-92 standard, and must be uppercase. If you do not prefix a Unicode string constant with N, SQL Server will convert it to the non-Unicode code page of the current database before it uses the string.

like image 123
Gabriele Petrioli Avatar answered Nov 13 '22 02:11

Gabriele Petrioli


are you using nvarchar type (rather than varchar)? would be recommended if you have multiple langs in the same column. that will let you store and retrieve properly.

of course, sql server can only maintain one collation type on a particular column, even if the column is being used to store strings in multiple languages, so that is something to consider...

like image 2
jspcal Avatar answered Nov 13 '22 00:11

jspcal