Skip to main content
1 of 3
qinking126
  • 551
  • 1
  • 5
  • 6

sql server 2008 insert statement question

I am learning sql server 2008 t-sql.

to insert a varchar type, I just need to insert a string 'abc', but for nvarchar type, I need to add N in front (N'abc')

I have a table employee, it has 2 fields, firstname and lastname, they are both nvarchar(20).

insert into employee values('abc', 'def'); I test it, it works, seems like N is not required.

please explain to me why we need to add N in front for nvarchar type, whats the pro or con if we are not using it?

qinking126
  • 551
  • 1
  • 5
  • 6