sql server - What is the meaning of the prefix N in T-SQL statements? -


i have seen prefix n in insert t-sql queries. many people have used n before inserting value in table.

i searched, not able understand purpose of including n before inserting strings table.

 insert personnel.employees  values(n'29730', n'philippe', n'horsford', 20.05, 1), 

it's declaring string nvarchar data type, rather varchar

you may have seen transact-sql code passes strings around using n prefix. denotes subsequent string in unicode (the n stands national language character set). means passing nchar, nvarchar or ntext value, opposed char, varchar or text.

to quote from microsoft:

prefix unicode character string constants letter n. without n prefix, string converted default code page of database. this default code page may not recognize characters.


if want know difference between these 2 data types, see post:

what difference between varchar , nvarchar?


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -