SQL Server:Datetimeoffset到时间戳(具有6位数秒的精度)

时间:2019-03-25 12:16:29

标签: sql-server

这是我的源列时间格式

2018-08-08 14:23:36.4865019 +01:00

同时检索预期的同一列只是

2018-08-08 14:23:36.486501 

您能帮我提供转换/广播声明吗?

1 个答案:

答案 0 :(得分:0)

使用datetime2作为数据类型

select cast ('2018-08-08 14:23:36.4865019 +01:00' as datetime2(6))

示例

 select cast (schema.dbo.A.[X] as datetime2(6)) FROM schema.dbo.A