在SQL Server中,当你处理Unicode字符串常量的时候,你必须在所有Unicode字符串前添加N前缀
来源:互联网 发布:江苏网络协会 编辑:程序博客网 时间:2024/05/29 17:41
You must precede all Unicode strings with a prefix N when you deal with Unicode string constants in SQL Server
When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data". The "N" prefix stands for National Language in the SQL-92 standard, and must be uppercase. If you do not prefix a Unicode string constant with N, SQL Server will convert it to the non-Unicode code page of the current database before it uses the string. (摘自msdn,http://support.microsoft.com/kb/239530/en-us )
----
例如如下一张表,
CREATE TABLE [dbo].[FeedbackData]( [username] [nvarchar](16) COLLATE Chinese_PRC_CI_AS NOT NULL, [avatar] [nvarchar](32) COLLATE Chinese_PRC_CI_AS NOT NULL, [title] [nvarchar](32) COLLATE Chinese_PRC_CI_AS NOT NULL, [location] [nvarchar](32) COLLATE Chinese_PRC_CI_AS NOT NULL, [datetime] [datetime] NOT NULL, [content] [nvarchar](256) COLLATE Chinese_PRC_CI_AS NOT NULL, [id] [uniqueidentifier] NOT NULL CONSTRAINT [DF_FeedbackData_uid] DEFAULT (newid())) ON [PRIMARY]
想要插入数据,则需要这样子写SQL:
insert into FeedbackData ( username, avatar, title, location, datetime, content)
values( N'张大千', N'3', N'界面问题很大', N'浙江省', '2013-01-02 00:02:00', N'中国的自我认识没有达到社会共识应有的低线,这是当前舆论场上出现一系列重大争议的根源之一。');
- 在SQL Server中,当你处理Unicode字符串常量的时候,你必须在所有Unicode字符串前添加N前缀
- Unicode 字符串,用 N 前缀
- 字符串处理你(在字符串前加符号)
- 教你在SQL Server数据库中拆分字符串函数
- 在汇编源文件中写入Unicode字符串
- python中unicode字符串前缀u
- VC中Unicode字符串的处理
- 转贴]VC中Unicode字符串的处理
- VC中Unicode字符串的处理
- [转贴]VC中Unicode字符串的处理
- VC中Unicode字符串的处理
- VC中Unicode字符串的处理
- 当我在想你的时候
- 当你写Makefile的时候你在想什么
- 使用 Unicode 的服务器端编程 (N前缀)--sql server 2005联机丛书
- hdu 4552 求所有字符串前缀在字符串中出现的总次数
- Unicode和字符串处理
- 开始学习LUA,在LUA中使用UNICODE字符串
- 开发者应该了解的 12 款 Eclipse 插件
- CMD常用命令
- 07 shell数组
- 解题报告 之 UVA11054 Wine trading in Gergovia
- 关于android学习的最近总结-2
- 在SQL Server中,当你处理Unicode字符串常量的时候,你必须在所有Unicode字符串前添加N前缀
- 精通shell编程第二版Sriranga Veeraraghavan著 卢涛notes
- 交大住宿费缴费回执复印件6月6号之前交到中财大厦1001
- Robot Framework中文站
- Linux 不回显输入代码
- 《像程序员一样思考》
- Android Studio中NDK开发
- 08 shell正则表达式
- eclipse 3.x RCP代码使用e4