0

I have a SQL Server database with default collation Latin1_General_CI_AS. My table's columns are of nvarchar or ntext data type.

The database is to for a website which can be multilingual, must support at least Polish, English, later also Ukrainian and French.

I am even struggling to make it accept Polish characters. With columns of type nvarchar/ntext, I can manually change a string in the database to use Polish special characters but when using insert or UPDATE statements the special characters are stripped of their accents.

Eg.

INSERT INTO Some_Table 
VALUES( 7, 'aśęóń', 'ąćł', 0.1, 1)

this ends up being 'aseón' and 'acl' in the second and third columns on INSERT or UPDATE so loses original characters.

I have tried to set up different collation but even if the field has Polish_CS_AS it doesn't accept Polish chars on insert/ update.

How to make the database to accept different language characters?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
nickornotto
  • 1,946
  • 4
  • 36
  • 68
  • 2
    You should use `VALUES( 7, N'aśęóń', N'ąćł', 0.1, 1)` (and also, you should stop using `ntext`, and use `nvarchar(max) instead) – Lamak Jan 03 '17 at 14:03
  • Try prefixing with N to column while insert like `INSERT INTO Some_Table VALUES( 7, N'aśęóń', N'ąćł', 0.1, 1)` – Shakeer Mirza Jan 03 '17 at 14:04
  • Thanks all, it work perfect now. – nickornotto Jan 03 '17 at 14:45
  • `ntext`, `text`, and `image` data types will be removed in a future version of SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use `nvarchar(max)`, `varchar(max)`, and `varbinary(max)` instead. [See details here](http://msdn.microsoft.com/en-us/library/ms187993.aspx) – marc_s Jan 03 '17 at 14:51

1 Answers1

2

Try:

INSERT INTO Some_Table VALUES( 7, N'aśęóń', N'ąćł', 0.1, 1) if you have already set the corresponding column to NVARCHAR and the total number of values you tried to insert equal to what your table has since you did not specify which columns need to be inserted.

LONG
  • 4,490
  • 2
  • 17
  • 35