简体   繁体   中英

UTF-8 character gets changed in INSERT statement on MS-SQL-Server

I have a table on my MS-SQL-Server 2008R2 that itself has an nvarchar(50) field.

Now when i insert a value using the Server Management Studio like

INSERT INTO INFORMATIONS(SOME_TEXT) VALUES('finančné služby')

and i immediately select the value

SELECT SOME_TEXT FROM INFORMATIONS

i get

financné služby

So the č does get converted into a plain c while the ž is handled just fine.

What am I missing here?

The collation is set to Latin1_General_CI_AS if that is of any help.

Prefix your values with N while inserting.

INSERT INTO INFORMATIONS(SOME_TEXT) VALUES(N'finančné služby')

CHECK SQL FIDDLE DEMO

如果您正在使用存储过程,则输入类型'Nvarchar' 而不是该特定文件的 Varchar ,您将存储 UTF-8 字符

Add N with the with string

  insert into Item_Registration ([fırstlan_arabic],[second_turkish])values(N'قهوة شوكو',N'قهوة شوكو')

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM