Emil
Emil

Reputation: 6891

Azure Sql table Column Collation Doesn't work for Turkish

I changed the collation of my column using script below as msdn suggests

ALTER TABLE dbo.myTable ALTER COLUMN NameTR 
            varchar(500) COLLATE SQL_Latin1_General_CP1254_CS_AS

when I check with the query

SELECT * FROM sys.fn_helpcollations()   
WHERE name LIKE 'SQL%' and description like '%turkish%';  

It returns me only 2 options as shown below. So either of them should be working for me.

enter image description here

However when I insert data into that column, I can see the ğ is converted into g, ı is converted into i and so on... only letter is working surprisingly is ç

when I verify my column, with the query, it looks fine to me. So why I can insert data correctly into this azure table?

 SELECT * FROM sys.columns      WHERE     name = 'nametr'

enter image description here

When I copy paste the value into the column using VS 2015 sql server explorer, It works fine but why It doesnt work using insert query. Do I have to collate insert query somehow?

Upvotes: 0

Views: 161

Answers (1)

Emil
Emil

Reputation: 6891

I found the answer finally. Insert statement should have N-prefix as below which is actually described here under title static strings. I hope this helps someone else having same issue

INSERT INTO table      VALUES(N'え', N'え'), ('え', 'え')  

Upvotes: 1

Related Questions