kacalapy
kacalapy

Reputation: 10154

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?

Upvotes: 20

Views: 27752

Answers (2)

Sachin Shanbhag
Sachin Shanbhag

Reputation: 55509

'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/

Upvotes: 26

Bleaourgh
Bleaourgh

Reputation: 1326

N indicates the string is encoded in Unicode.

Upvotes: 6

Related Questions