当前位置:网站首页>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
边栏推荐
- sql查询:将下一行减去上一行,并做相应的计算
- PTA 天梯赛练习题集 L2-004 搜索树判断
- AI face editor makes Lena smile
- ForkJoin最全详解(从原理设计到使用图解)
- Go language context explanation
- 淘宝店铺发布API接口(新),淘宝oAuth2.0店铺商品API接口,淘宝商品发布API接口,淘宝商品上架API接口,一整套发布上架店铺接口对接分享
- Randomly generate session_ id
- Modes of optical fiber - single mode and multimode
- Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
- In memory, I moved from CSDN to blog park!
猜你喜欢

Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)

Distributed global ID generation scheme

JVM the truth you need to know

常用消息队列有哪些?
上海字节面试问题及薪资福利

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

Sidecar mode

Three level menu data implementation, nested three-level menu data

集群、分布式、微服務的區別和介紹

驱动开发中platform设备驱动架构详解
随机推荐
zabbix_get测试数据库失败
pytorch_ 01 automatic derivation mechanism
淘宝店铺发布API接口(新),淘宝oAuth2.0店铺商品API接口,淘宝商品发布API接口,淘宝商品上架API接口,一整套发布上架店铺接口对接分享
《2022中国低/无代码市场研究及选型评估报告》发布
Introduction to distributed transactions
980. 不同路径 III DFS
不同网段之间实现GDB远程调试功能
Flinksql 读写pgsql
《HarmonyOS实战—入门到开发,浅析原子化服务》
【已解决】记一次EasyExcel的报错【读取xls文件时全表读不报错,指定sheet名读取报错】
MySQL-CentOS7通过YUM安装MySQL
Determine whether the file is a DICOM file
Flinksql read / write PgSQL
404 not found service cannot be reached in SAP WebService test
力扣102题:二叉树的层序遍历
Industrial Finance 3.0: financial technology of "dredging blood vessels"
Cve-2021-3156 vulnerability recurrence notes
2pc of distributed transaction solution
Opensergo is about to release v1alpha1, which will enrich the service governance capabilities of the full link heterogeneous architecture
What is message queuing?