SQL代码中的西里尔字符在插入后不正确 [英] Cyrillic symbols in SQL code are not correctly after insert

查看:82
本文介绍了SQL代码中的西里尔字符在插入后不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SQL Server 2005,我尝试存储西里尔字符,但我不能与SQL代码,试图运行这是SQL Server:

I use SQL Server 2005 and I am try to store Cyrillic characters but I can't with SQL code by trying to run this is SQL Server:

INSERT INTO Assembly VALUES('Македонски парлиамент број 1','','');

或者从C#发生同样的问题,但插入/更新列从SQL Server它的工作,是正常存储。

Or from C# is happening the same problem but inserting/updating the column from SQL Server it work and it is store normally.

列的数据类型为 nvarchar

推荐答案

您必须在字符串之前添加N前缀。

You have to add N prefix before your string.

当您隐式声明一个字符串变量时, varchar。添加前缀N表示后续字符串为Unicode(nvarchar)。

When you implicitly declare a string variable it is treated as varchar by default. Adding prefix N denotes that the subsequent string is in Unicode (nvarchar).

 INSERT INTO Assembly VALUES(N'Македонски парлиамент број 1','','');

这是一些阅读:

a href =http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix.html =noreferrer> http://databases.aspfaq。 com / general / why-do-some-sql-strings-have-an-n-prefix.html

http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix.html

https://msdn.microsoft.com/en-IN/library/ms186939.aspx

在T-SQL语句中前缀N的含义是什么?

这篇关于SQL代码中的西里尔字符在插入后不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆