当前位置:网站首页>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。
边栏推荐
- Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
- How to choose the appropriate certificate brand when applying for code signing certificate?
- 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
- Coding devsecops helps financial enterprises run out of digital acceleration
- There is a powerful and good-looking language bird editor, which is better than typora and developed by Alibaba
- Topology visual drawing engine
- Crud de MySQL
- 我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
- anaconda使用中科大源
- Brief introduction of machine learning framework
猜你喜欢

做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史

Implement a blog system -- using template engine technology

Crud of MySQL

【leetcode周赛总结】LeetCode第 81 场双周赛(6.25)

qt creater断点调试程序详解

有一个强大又好看的,赛过Typora,阿里开发的语雀编辑器

Fr exercise topic --- comprehensive question
![[JVM] operation instruction](/img/f5/85580495474ef58eafbb421338e93f.png)
[JVM] operation instruction

Ctfshow web entry explosion

Topology visual drawing engine
随机推荐
CPU设计实战-第四章实践任务三用前递技术解决相关引发的冲突
我想咨询一下,mysql一个事务对于多张表的更新,怎么保证数据一致性的?
Under the crisis of enterprise development, is digital transformation the future savior of enterprises
Talking about how dataset and dataloader call when loading data__ getitem__ () function
729. 我的日程安排表 I :「模拟」&「线段树(动态开点)」&「分块 + 位运算(分桶)」
How to open an account of qiniu securities? Is it safe to open an account?
webRTC SDP mslabel lable
【数组和进阶指针经典笔试题12道】这些题,满足你对数组和指针的所有幻想,come on !
MySQL之CRUD
Implement a blog system -- using template engine technology
基于TI DRV10970驱动直流无刷电机
easyOCR 字符識別
Crud of MySQL
Coding devsecops helps financial enterprises run out of digital acceleration
STM32+BH1750光敏传感器获取光照强度
CODING DevSecOps 助力金融企业跑出数字加速度
webRTC SDP mslabel lable
Thymeleaf uses background custom tool classes to process text
I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
爱可可AI前沿推介(7.5)