当前位置:网站首页>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
边栏推荐
- [shell] clean up nohup Out file
- zabbix_ Get test database failed
- Ten stages of becoming a Senior IC Design Engineer. What stage are you in now?
- Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
- [daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
- C nullable type
- Mybaits multi table query (joint query, nested query)
- SAP webservice 测试出现404 Not found Service cannot be reached
- Go language context explanation
- Dynamic memory management
猜你喜欢

How to improve website weight

AI人脸编辑让Lena微笑

Red Hat安装内核头文件

Opensergo is about to release v1alpha1, which will enrich the service governance capabilities of the full link heterogeneous architecture

What is message queuing?

R语言【逻辑控制】【数学运算】

4. 对象映射 - Mapping.Mapster

Message queuing: how to ensure that messages are not lost

AI face editor makes Lena smile

Sidecar mode
随机推荐
4. 对象映射 - Mapping.Mapster
Pinduoduo product details interface, pinduoduo product basic information, pinduoduo product attribute interface
STM32按键状态机2——状态简化与增加长按功能
PTA 天梯赛练习题集 L2-004 搜索树判断
EMMC print cqhci: timeout for tag 10 prompt analysis and solution
4. Object mapping Mapster
Explication contextuelle du langage Go
得物客服一站式工作台卡顿优化之路
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server
Randomly generate session_ id
Differences and introduction of cluster, distributed and microservice
async / await
PTA 天梯赛练习题集 L2-003 月饼 测试点2,测试点3分析
Red Hat安装内核头文件
【日常训练--腾讯精选50】292. Nim 游戏
如何提高网站权重
Taobao store release API interface (New), Taobao oauth2.0 store commodity API interface, Taobao commodity release API interface, Taobao commodity launch API interface, a complete set of launch store i
R language [logic control] [mathematical operation]
make makefile cmake qmake都是什么,有什么区别?
数据中心为什么需要一套基础设施可视化管理系统