当前位置:网站首页>SQL sever基本数据类型详解
SQL sever基本数据类型详解
2022-06-24 09:40:00 【Cpsu】
| 分类及数据特性 | 数据类型(不区分大小写) |
|---|---|
| 整数数据类型 | BIT 、INT、SAMLLINT、TINYINT |
| 货币数据类型 | MONEY、SMALLMONEY |
| 浮点数据类型 | REAL、FLOAT、DECIMAL、NUMERIC |
| 日期/时间数据类型 | DATETIME、SMALLDATETIME、DATA、DATETIME(2)、DATETIMESTAMPOFFSET |
| 字符数据类型 | CHAR、NCHAR(n)、VARCHAR、NVARCHAR(n) |
| 二进制数据类型 | BINARY、VARBINARY |
| 图像和文本数据类型 | TEXT、NTEXT(n)、IMAGE |
字符型数据类型
char: 固定长度,存储ANSI字符,不足的补英文半角空格。
nchar(n): 固定长度,存储Unicode字符,不足的补英文半角空格
varchar: 可变长度,存储ANSI字符,根据数据长度自动变化。
nvarchar(n): 可变长度,存储Unicode字符,根据数据长度自动变化。
如果你肯定存储的数据长度,而且不包中文的,可以选择char类型。
如果肯定存储的数据长度,但可能包括中文,可以选择nchar类型。
如果不确定存储的数据长度,存储只有英文、数字的最好用varchar
如果不确定存储的数据长度,也有可能有中文,可以选择nvarchar类型,在SQL Server2005中也是比较常用的字符数据类型。
原文链接:https://www.cnblogs.com/flyrock/archive/2012/07/08/2581234.html
浮点数据类型参考:
https://www.cnblogs.com/Sungeek/p/12167796.html
日期/时间数据类型参考:
https://blog.csdn.net/qq_39019865/article/details/81061521
整数数据类型参考:
https://www.cnblogs.com/ButterflyEffect/p/8944706.html
图像和文本类型参考:
https://blog.csdn.net/lishimin1012/article/details/50526988
边栏推荐
- 队列Queue
- JCIM|药物发现中基于AI的蛋白质结构预测:影响和挑战
- MYSQL数据高级
- 简单的价格表样式代码
- How to standardize data center infrastructure management process
- PHP encapsulates a file upload class (supports single file and multiple file uploads)
- How do novices choose the grade of investment and financial products?
- Latex formula and table recognition
- Operator details
- linux下oracle服务器打开允许远程连接
猜你喜欢

Groovy obtains Jenkins credentials through withcredentials

Getting user information for applet learning (getuserprofile and getUserInfo)

canvas管道动画js特效

Nvisual digital infrastructure operation management software platform

Programming questions (continuously updated)

canvas掉落的小球重力js特效动画

vim的使用

美国电子烟巨头 Juul 遭遇灭顶之灾,所有产品强制下架

JS singleton mode

Indexeddb local storage, homepage optimization
随机推荐
LeetCode: 137. Number II that appears only once
JS proxy mode
Can the long-term financial products you buy be shortened?
Latex formula and table recognition
物联网?快来看 Arduino 上云啦
Wechat applet learning to achieve list rendering and conditional rendering
PostgreSQL DBA quick start - source compilation and installation
队列Queue
canvas 绘制图片
编程题(持续更新)
分布式 | 如何与 DBLE 进行“秘密通话”
2021-08-17
如何管理海量的网络基础设施?
SSH Remote Password free login
ByteDance Interviewer: talk about the principle of audio and video synchronization. Can audio and video be absolutely synchronized?
vim的使用
How to improve the efficiency of network infrastructure troubleshooting and bid farewell to data blackouts?
Is there a reliable and low commission futures account opening channel in China? Is it safe to open an account online?
413 binary tree Foundation
416 binary tree (first, middle and last order traversal iteration method)