nvarchar - what is the difference?

  • I am developing for internationlization.

    create table Test1(name nvarchar(10))

    insert into Test1 (name) values (N'abcd')

    insert into Test1 (name) values ('abcd')

    They both work.

    My question is what is the difference?

    Will I miss something if I don't add N in the value?

    Thanks for you help,

    Neo

  • In the second INSERT statement, SQL Server will do an implicit conversion for you. Generally there aren't any issues with allowing SQL Server to do the conversion. However, if you know the field is going to be Unicode, it's probably better to explicitly state the string as Unicode by preceeding it with the N.

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • Thanks Brian. That is exactly what I have decided. Your answer helps!

    Neo

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply