当前位置:网站首页>sql server char nchar varchar和nvarchar的区别
sql server char nchar varchar和nvarchar的区别
2022-07-05 14:49:00 【蓝天⊙白云】
- char:固定长度,
存储ansi字符,不足的补英文半角空格。 - nchar:固定长度,
存储Unicode字符,不足的补英文半角空格。 - varchar(n):长度为 n 个字节的
可变长度且非 Unicode 的字符数据。n 必须是一个介于 1 和 8,000 之间的数值。存储大小为输入数据的字节的实际长度,而不是 n 个字节。 - nvarchar(n):包含 n 个字符的
可变长度 Unicode 字符数据。n 的值必须介于 1 与 4,000 之间。字节的存储大小是所输入字符个数的两倍。 - TEXT
text存储可变长度的非Unicode数据,最大长度为2^31-1(2,147,483,647)个字符。 - NCHAR、NVARCHAR、NTEXT
这三种从名字上看比前面三种多了个"N"。和char、varchar比较起来,nchar、nvarchar最多存储4000个字符,不论是英文还是汉字;而char、varchar最多能存储8000个英文,4000个汉字。可以看出使用nchar、nvarchar数据类型时不用担心输入的字符是英文还是汉字,较为方便,但在存储英文时数量上有些损失。
所以一般来说,如果含有中文字符,用nchar/nvarchar,如果纯英文和数字,用char/varchar。
边栏推荐
- Is it OK to open the securities account on the excavation finance? Is it safe?
- [JVM] operation instruction
- webRTC SDP mslabel lable
- Is the securities account given by the head teacher of qiniu school safe? Can I open an account?
- Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
- 微帧科技荣获全球云计算大会“云鼎奖”!
- [summary of leetcode weekly competition] the 81st fortnight competition of leetcode (6.25)
- CPU设计相关笔记
- PostgreSQL 13 installation
- 通过npm 或者 yarn安装依赖时 报错 出现乱码解决方式
猜你喜欢

Drive brushless DC motor based on Ti drv10970

PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用

P1451 求细胞数量/1329:【例8.2】细胞
![[JVM] operation instruction](/img/f5/85580495474ef58eafbb421338e93f.png)
[JVM] operation instruction

Creation and use of thymeleaf template
![[12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!](/img/d2/c0a19c85b2011ecd07c9944d996c4d.png)
[12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!

How to paste the contents copied by the computer into mobaxterm? How to copy and paste

用 Go 跑的更快:使用 Golang 为机器学习服务

There is a powerful and good-looking language bird editor, which is better than typora and developed by Alibaba

Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de
随机推荐
【C 题集】of Ⅷ
Drive brushless DC motor based on Ti drv10970
市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生
Microframe technology won the "cloud tripod Award" at the global Cloud Computing Conference!
useMemo,memo,useRef等相关hooks详解
Thymeleaf uses background custom tool classes to process text
How to solve the problem of garbled code when installing dependency through NPM or yarn
P1451 求细胞数量/1329:【例8.2】细胞
如何将电脑复制的内容粘贴进MobaXterm?如何复制粘贴
计算中间件 Apache Linkis参数解读
IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
[detailed explanation of Huawei machine test] happy weekend
Anaconda uses China University of science and technology source
我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de
一键更改多个文件名字
Select sort and bubble sort
CPU design related notes
CPU设计相关笔记