Saving Russian text on SQL server

I have a database (SQL Server express 2008) that has a column that is defined as text. When we try to save some text that is in Chinese, it is not saved. I read that the field must be ntext. Now I need to convert to a table in order to create a column as ntext.

Do I need to do anything with sorting a database that is installed in Latin?

Jd

+4
source share
2 answers

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

Sorting refers only to sort order, indexing, and comparisons. If you saved only Chinese data, you can use Chinese_PRC_90_CI_AI or the appropriate sort.

update after 1st comment:

For NVARCHAR (and NTEXT), mapping settings do not affect how data is stored. As I said, this affects the comparison and sorting.

If you know that there will be Chinese data in the field, Chinese sorting is best. (I only recently experienced some problems finding Chinese characters, as in some comparisons some characters are equal to punctuation marks)

If you know that you are looking for data in other languages, you can still change the sorting using the COLLATE clause in comparison or ORDER BYs

+8
source

Make sure you change the column type as devio suggests, and change the parameter type of any stored procedure associated with the table. If you have an NTEXT field, but the stored parameter proc is TEXT, it will not save the value.

+1
source

Source: https://habr.com/ru/post/1306947/


All Articles