开发者

SQL Server 2005: what does the letter N for (...WHERE Name LIKE N'F%')

Just like the subject stated:

what does the letter N do in SQL like this:

SELECT P.ProductID,
       S.SupplierID,
       S.CompanyName
FROM Suppliers AS S JOIN Products AS P
开发者_运维知识库     ON (S.SupplierID = P.SupplierID)
WHERE P.UnitPrice > $10
  AND S.CompanyName LIKE N'F%' -- what is the N for?


'N' stands for representing unicode characters.

What this N does is tell the SQL Server that the data which is being passed in is uni-code and not character data. When using only the Latin character set this is not really needed. However if using characters which are not part of the basic Latin character set then the N is needed so that SQL knows that the data being given it is uni-code data.

Original source - http://itknowledgeexchange.techtarget.com/sql-server/whats-up-with-the-n-in-front-of-string-values/


N indicates the string is encoded in Unicode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜