1

I want to store a balkan surname in my sql server db but when I try and update a recordes using the following SQL:

update User_Data
set name = 'Kramarić'
where User_PKID= 3047

However when I query the db with:

select name from User_Data where User_PKID = 3047

it returns:

Kramaric

Any idea on how I can get it to store it in its original form. I need it as such as I do a string comparison on my server code with data coming from a website and if the 'ć' isn't the same it fails.

Sperick
  • 2,691
  • 6
  • 30
  • 55
  • 1
    Have you tried using nvarahar? This link might help you: http://stackoverflow.com/questions/7038213/which-special-characters-are-allowed-in-sql-server-varchar-fields – user11998 Jan 17 '15 at 13:02

2 Answers2

7

What datatype is your column name? It should be NVARCHAR to handle Unicode characters.

And you also must use the N'...' prefix to specify Unicode strings:

UPDATE dbo.User_Data
SET name = N'Kramarić'
WHERE User_PKID= 3047
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
1

See You must precede all Unicode strings with a prefix N when you deal with Unicode string constants in SQL Server

update User_Data
set name = N'Kramarić'
where User_PKID= 3047
Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317