SQL数据库中查询中加N'' 前缀是什么意思

It's declaring the string as nvarchar data type, rather than varchar

You may have seen Transact-SQL code that passes strings around using an N prefix. This denotes that the subsequent string is in Unicode (the N actually stands for National language character set). Which means that you are passing an NCHAR, NVARCHAR or NTEXT value, as opposed to CHAR, VARCHAR or TEXT.

To quote from Microsoft:

Prefix Unicode character string constants with the letter N. Without the N prefix, the string is converted to the default code page of the database. This default code page may not recognize certain characters.

上一篇:SQL数据库中临时表、临时变量和WITH AS关键词创建“临时表”的区别


下一篇:SQL 2005 中查询或执行另外的数据库操作的方法