Just like in the question, not sure what the difference between '' and N'' in SQL.
3 Answers
It's shorthand for Nvarchar. Using that notation tells the parser to treat the following string data as nvarchar instead of the default varchar.
Example:
SELECT N'This is a test'; -- NVarChar data SELECT 'Test is a test'; -- VarChar data 2 Comments
N stores UNICODE data just like NVARCHAR and VARCHAR
An nvarchar column can store any Unicode data. A varchar column is restricted to an 8-bit codepage. Some people think that varchar should be used because it takes up less space. I believe this is not the correct answer. Codepage incompatabilities are a pain, and Unicode is the cure for codepage problems. With cheap disk and memory nowadays, there is really no reason to waste time mucking around with code pages anymore.
2 Comments
nvarchar by default. In some cases where I know I'm only storing something like a product code, or state abbreviation I'll fall back on varchar instead.NVARCHAR column and eventually it will get a Buddhist sutra in Chinese Unicode.