Why do we need to put N before strings in Microsoft SQL Server?

Posted by user61752 on Programmers See other posts from Programmers or by user61752
Published on 2012-07-06T14:47:11Z Indexed on 2012/07/06 21:24 UTC
Read the original article Hit count: 236

I'm learning T-SQL. From the examples I've seen, to insert text in a varchar() cell, I can write just the string to insert, but for nvarchar() cells, every example prefix the strings with the letter N.

I tried the following query on a table which has nvarchar() rows, and it works fine, so the prefix N is not required:

insert into [TableName] values ('Hello', 'World')

Why the strings are prefixed with N in every example I've seen?

What are the pros or cons of using this prefix?

© Programmers or respective owner

Related posts about sql

Related posts about sql-server