Reputation: 263
I have table with two varchar
columns first_name
and last_name
.
Now I need to convert these columns to nvarchar
in order to support UTF-8.
I choose nvarchar
datatype in SSMS for these columns and when I try to enter some UTF-8 data, my symbols converts to question marks. For example, if I input йцукен
(Ukrainian) it will be converted to ??????
.
What is the problem and how to fix it?
Thanks.
Upvotes: 1
Views: 2499
Reputation: 754298
When you want to insert nvarchar
literals into the database table, you must use the N'..'
prefix.
So use
INSERT INTO dbo.YourTable(First_Name)
VALUES(N'йцукен')
so that this string will be treated as a unicode string
If you're not using the N'..'
notation, you're really inserting a non-unicode string literal - and this will cause these conversions to ?
Upvotes: 5