What is the difference between varchar and nvarchar?

后端 未结 19 2589
野的像风
野的像风 2020-11-22 04:05

Is it just that nvarchar supports multibyte characters? If that is the case, is there really any point, other than storage concerns, to using varchars

19条回答
  •  猫巷女王i
    2020-11-22 04:14

    Jeffrey L Whitledge with ~47000 reputation score recommends usage of nvarchar

    Solomon Rutzky with with ~33200 reputation score recommends: Do NOT always use NVARCHAR. That is a very dangerous, and often costly, attitude / approach.

    What are the main performance differences between varchar and nvarchar SQL Server data types?

    https://www.sqlservercentral.com/articles/disk-is-cheap-orly-4

    Both persons of such a high reputation, what does a learning sql server database developer choose?

    There are many warnings in answers and comments about performance issues if you are not consistent in choices.

    There are comments pro/con nvarchar for performance.

    There are comments pro/con varchar for performance.

    I have a particular requirement for a table with many hundreds of columns, which in itself is probably unusual ?

    I'm choosing varchar to avoid going close to the 8060 byte table record size limit of SQL*server 2012.

    Use of nvarchar, for me, goes over this 8060 byte limit.

    I'm also thinking that I should match the data types of the related code tables to the data types of the primary central table.

    I have seen use of varchar column at this place of work, South Australian Government, by previous experienced database developers, where the table row count is going to be several millions or more (and very few nvarchar columns, if any, in these very large tables), so perhaps the expected data row volumes becomes part of this decision.

提交回复
热议问题