什么N'代表在SQL脚本? (在插入脚本字符之前使用的) [英] What does N' stands for in a SQL script ? (the one used before characters in insert script)
问题描述
我生成的SQL脚本这样的,
I generated an sql script like this,
INSERT [dbo].[TableName] ([Sno], [Name], [EmployeeId], [ProjectId], [Experience])
VALUES (1, N'Dave', N'ESD157', N'FD080', 7)
我不知道什么是N'恰恰意味着什么以及其目的在这里。
I wonder whats that N' exactly mean and whats its purpose here.
注意:通过搜索答案所有我能得到的是N'是国家语言标准一preFIX及其使用UNI code数据。但老实说,我不能够获得有关的N'这里的确切操作一个清晰的思路。我倒是AP preciate您的帮助和请它更多的理解办法。先谢谢了。
NOTE: By searching for the answer all i can get is that N' is a prefix for National language standard and its for using unicode data. But honestly i am not able to get a clear idea about the exact operation of N' here. I'd appreciate your help and please make it in more of an understandable way. Thanks in advance.
推荐答案
N
用于指定一个UNI code字符串。
N
is used to specify a unicode string.
下面是一个很好的讨论,<一个href=\"http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-$p$pfix.html\">http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-$p$pfix.html
Here's a good discussion http://databases.aspfaq.com/general/why-do-some-sql-strings-have-an-n-prefix.html
在您的例子 N
preFIX不是必需的,因为ASCII字符(值小于128)直接映射到UNI code。但是,如果你想插入未则ASCII名称的 N
preFIX将需要。
In your example N
prefix is not required because ASCII characters (with value less than 128) map directly to unicode. However, if you wanted to insert a name that was not ASCII then the N
prefix would be required.
INSERT [dbo].[TableName] ([Sno], [Name], [EmployeeId], [ProjectId], [Experience])
VALUES (1, N'Wāhi', 'ESD157', 'FD080', 7)
这篇关于什么N'代表在SQL脚本? (在插入脚本字符之前使用的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!