Varchar(max) 和 nvarchar(max) 的区别 [英] Difference between Varchar(max) and nvarchar(max)
问题描述
我在为我的应用程序构建架构时遇到了一个问题.
I came across a question while buidling schema for my application.
何时使用 varchar(max)
和 nvarchar(max)
.我的意思是应该应用它的确切用例.我也上网冲浪,但我能够得到确切的答案.
When to use varchar(max)
and nvarchar(max)
. I mean the exact use cases where it should be applied. I have surfed in net too but I was able to get the exact answer.
谁能建议一些确切的用例.
Could anyone suggest some exact usecase.
推荐答案
This is for Microsoft SQL Server:
This is for Microsoft SQL Server:
NVARCHAR
是 Unicode - 每个字符 2 个字节,因此最大.10 亿个字符;将处理东亚、阿拉伯、希伯来、西里尔等字符就好了.
NVARCHAR
is Unicode - 2 bytes per character, therefore max. of 1 billion characters; will handle East Asian, Arabic, Hebrew, Cyrillic etc. characters just fine.
VARCHAR
是非 Unicode - 每个字符最多 1 个字节.容量为 20 亿个字符,但仅限于 SQL Server 使用的字符集,基本上 - 不支持前面提到的那些语言
VARCHAR
is non-Unicode - 1 byte per character, max. capacity is 2 billion characters, but limited to the character set you're SQL Server is using, basically - no support for those languages mentioned before
这篇关于Varchar(max) 和 nvarchar(max) 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!