Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving russian text in SQL server

Tags:

sql-server

I have a database (SQL server express 2008) which has a column that is defined as text. When we try to store some text which is in chinese, it is not saved. I read that the field should be ntext. I will now have to a conversion to my table to create the column as ntext.

Would I have to do anything with the collation of the database which is set to Latin?

JD

like image 422
JD. Avatar asked Dec 28 '22 20:12

JD.


1 Answers

You need to change the column to NTEXT or NVARCHAR(MAX).

Collation only relates to sort order, indexing, and comparisons. If you stored only Chinese data, you can use Chinese_PRC_90_CI_AI or a related collation.

update after 1st comment:

For NVARCHAR (and NTEXT), the collation setting does not affect the way data is stored. As I stated before, it affects comparisons and sorting.

If you know that there will be Chinese data in a field, it's best to use a Chinese collation. (I just recently experienced some problems when searching for Chinese characters, as in some collations some characters equal punctuation characters)

If you know that you are searching for data in other languages, you can still change the collation using the COLLATE clause in comparisons or ORDER BYs

like image 165
devio Avatar answered Jan 25 '23 23:01

devio