当前位置:网站首页>SQL Server 2008 各种DateTime的取值范围
SQL Server 2008 各种DateTime的取值范围
2022-07-07 00:35:00 【51CTO】
在SQL SERVER中DATETIME表示的时间为00:00:00到23:59:59.997,它的时间精度为1/300秒,在使用时会舍入到舍入到 .000、.003 或 .007 秒三个增量。如下表是DATETIME秒的小数部分精度的舍入。
用户指定的值 | 使用DateTime类型时系统存储的值 |
1998-1-1 23:59:59.990 1998-1-1 23:59:59.991 | 1998-01-01 23:59:59.990 |
1998-1-1 23:59:59.992 1998-1-1 23:59:59.993 1998-1-1 23:59:59.994 | 1998-01-01 23:59:59.993 |
1998-1-1 23:59:59.995 1998-1-1 23:59:59.996 1998-1-1 23:59:59.997 1998-1-1 23:59:59.998 | 1998-01-01 23:59:59.997 |
1998-1-1 23:59:59.999 | 1998-01-02 00:00:00.000 |
在SQL SERVER 2008中新增了Datetime2类型,可以提供更高的时间精度,且可以自定义时间精度,以后可以使用这种数据类型。Datetime2的精度是100 纳秒。
SQL Server 2008除了DateTime和SmallDateTime之外,又新增了四种时间类型,分别为:date,time,datetime2和datetimeoffset。
各时间类型范围、精度一览表:
数据类型 | 时间范围 | 精度 |
Smalldatetime | 1900-01-01 到 2079-06-06 00:00:00 到 23:59:59 | 分钟 |
Datetime | 1753-01-01到9999-12-31 00:00:00 到 23:59:59.997 | 3.33毫秒 |
Time | 00:00:00.0000000 到 23:59:59.9999999 | 100 纳秒 |
Date | 0001-01-01 到 9999-12-31 | 天 |
Datetime2 | 0001-01-01 到 9999-12-31 00:00:00 到 23:59:59.9999999 | 100 纳秒 |
Datetimeoffset | 0001-01-01 到 9999-12-31 00:00:00 到 23:59:59.9999999 -14:00 到 +14:00 | 100 纳秒 |
各时间类型表达式一览表: 数据类型 输出 time 12:35:29. 1234567 date 2007-05-08 smalldatetime 2007-05-08 12:35:00 datetime 2007-05-08 12:35:29.123 datetime2 2007-05-08 12:35:29. 1234567 datetimeoffset 2007-05-08 12:35:29.1234567 +12:15
边栏推荐
- TCC of distributed transaction solutions
- What is message queuing?
- 5阶多项式轨迹
- Pytorch builds neural network to predict temperature
- 拼多多新店如何获取免费流量,需要从哪些环节去优化,才能有效提升店内免费流量
- 力扣102题:二叉树的层序遍历
- 原生小程序 之 input切換 text與password類型
- The 2022 China low / no code Market Research and model selection evaluation report was released
- 《2022中国低/无代码市场研究及选型评估报告》发布
- 如何提高网站权重
猜你喜欢
![[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree](/img/4c/16bb943e517c7b703996715632e6ca.png)
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree

Digital IC interview summary (interview experience sharing of large manufacturers)

PowerPivot——DAX(函数)

Dynamic memory management

TCC of distributed transaction solutions

AI face editor makes Lena smile

不同网段之间实现GDB远程调试功能

sql查询:将下一行减去上一行,并做相应的计算

Red Hat安装内核头文件

往图片添加椒盐噪声或高斯噪声
随机推荐
How to get free traffic in pinduoduo new store and what links need to be optimized in order to effectively improve the free traffic in the store
Paper reading [open book video captioning with retrieve copy generate network]
不同网段之间实现GDB远程调试功能
What is dependency injection (DI)
The 2022 China low / no code Market Research and model selection evaluation report was released
Nvisual network visualization
Flink SQL realizes reading and writing redis and dynamically generates hset key
async / await
Paper reading [semantic tag enlarged xlnv model for video captioning]
JVM the truth you need to know
Flask1.1.4 Werkzeug1.0.1 源码分析:启动流程
Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
Taobao commodity details page API interface, Taobao commodity list API interface, Taobao commodity sales API interface, Taobao app details API interface, Taobao details API interface
随机生成session_id
淘宝店铺发布API接口(新),淘宝oAuth2.0店铺商品API接口,淘宝商品发布API接口,淘宝商品上架API接口,一整套发布上架店铺接口对接分享
win配置pm2开机自启node项目
分布式事务解决方案之TCC
Lombok plug-in
微信小程序蓝牙连接硬件设备并进行通讯,小程序蓝牙因距离异常断开自动重连,js实现crc校验位
4. 对象映射 - Mapping.Mapster