VARCHAR 完全像 1990 年代吗? [英] Is VARCHAR like totally 1990s?

查看:37
本文介绍了VARCHAR 完全像 1990 年代吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. VARCHAR 不存储 Unicode 字符.
  2. NVARCHAR 确实存储 Unicode 字符.
  3. 当今的应用程序应始终与 Unicode 兼容.
  4. NVARCHAR 需要两倍的空间来存储它.
  5. 第 4 点无关紧要,因为存储空间非常便宜.

因此:在当今设计 SQL Server 数据库时,应始终使用 NVARCHAR.

Ergo: When designing SQL Server databases today, one should always use NVARCHAR.

这是合理的推理吗?有人不同意任何前提吗?今天有什么理由选择 VARCHAR 而不是 NVARCHAR?

Is this sound reasoning? Does anyone disagree with any of the premises? Are there any reasons to choose VARCHAR over NVARCHAR today?

推荐答案

您将数据类型与将存储在列中的数据相匹配.通过类似的论点,您可以说为什么不将所有数据存储在 NVARCHAR 列中,因为数字和日期可以表示为数字字符串.

You match the datatype with the data that will be stored in the column. By a similar argument you could say why not store all data in NVARCHAR columns, because numbers and dates can be represented as strings of digits.

如果将存储在列中的数据的最佳匹配是 VARCHAR,则使用它.

If the best match for the data that will be stored in the column is VARCHAR, then use it.

这篇关于VARCHAR 完全像 1990 年代吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆