惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 一江秋水

oracle 数据库 web 开发 正则表达式 职业生涯【3】认真对待选择 职业生涯【2】选择行业、领导 职业生涯【1】选择职业 IE8正在连接(二级页面无法打开) Win7允许/禁用 PING命令 SQL2008 安装后启用 Sa 用户的方法 - 一江秋水 项目计划管理--(摘录) 如何收缩和删除SQL日志文件 IBatis—源码解析【DataAccess】 IBatis—源码解析【DataMapper】 Ibatis—源码解析【Common】 JavaScript中Eval详解 JavaScript调用WebServices 自动从起数据库服务 DataGridView显示行号 中国移动的短信息服务中心 - 一江秋水 - 博客园 Socket(同步与异步) C# 中用Socket实现判断网络是否断开的实例
sql server中的varchar和Nvarchar有什么区别
一江秋水 · 2008-12-02 · via 博客园 - 一江秋水

    SQL Server提供两种数据类型来存储字符信息。在如何在SQL Server或应用程序中使用方面,这两种数据类型大致是一样的。差别在于nvarchar是用于存储处理数据库图表中多语言数据的Unicode数据。其它语言有一套需要保存的字符代码的扩展集,这种数据类型支持这样的扩展。因为需要存储其它语言的扩展字符代码,nvarchar占用的空间是varchar的两倍。

      字符中,英文字符只需要一个字节存储就足够了,但汉字众多,需要两个字节存储,英文与汉字同时存在时容易造成混乱,Unicode字符集就是为了解决字符集这种不兼容的问题而产生的,它所有的字符都用两个字节表示,即英文字符也是用两个字节表示。

  varchar(n)
 长度为 n 个字节的可变长度且非 Unicode 的字符数据。n 必须是一个介于 1 和 8,000 之间的数值。存储大小为输入数据的字节的实际长度,而不是 n 个字节。

 nvarchar(n)
 包含 n 个字符的可变长度 Unicode 字符数据。n 的值必须介于 1 与 4,000 之间。字节的存储大小是所输入字符个数的两倍。

 两字段分别有字段值:我和coffee
 那么varchar字段占2×2+6=10个字节的存储空间,而nvarchar字段占8×2=16个字节的存储空间。

 如字段值只是英文可选择varchar,而字段值存在较多的双字节(中文、韩文等)字符时用nvarchar