Nvarchar Vs Varchar....

  • Hi there,

    I have a question...

    I am comparing 2 table which have few similar fields like Name. In table 1: Name is nvarchar & in table 2 its varchar.

    while comparing names, Names w/ special charcarters in table 1 appear differently in table 2.

    for eg:

    é (table1.name[nvarchar])-- becomes T(table2.Name[varchar])

    could this be simply because of different datatypes?

    secondly, I assume it should b possbile to test this .. creating a dummy table and testing results.But if I use SSMS, insert clause.. both names comes same. By default, SSIS doesn't allow me to insert a nvarchar value to table with varchar datatype.

    Please Advise.

    Thanks

  • Varchar is the basic string type. nvarchar is for handling unicode characters, such as é, or other language characters.

    You can change the table datatype to nvarchar, but be aware that Unicode characters take twice as much space as non-unicode.

    This is why, sometimes, you see weird characters appear from the varchar columns.

    Cheers,

    J-F

    Cheers,

    J-F

  • ok. gotcha!

    Thanks for quick reply.

    My guess was right....

    Btw, is it possible to test this behavior? I couldn't figure how to do it. 🙁

    I created a excel sheet with such names.. and tried to insert them into SQL table w/ varchar datatype. Now, SSIS doesn't allow me to do it. It does if I use Data conversion task... but then, special characters comes as they were entered.

    thank you!

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

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