在SQL Server中,postgresql的"timestamp without time zone"类型对应的是"datetime2"类型。使用DateTime类型是否可行取决于您需要处理的数据精度和时区信息是否重要。
对于新开发,您可以使用 datetime2
数据类型,而不是 "plain" datetime
。它存储一个没有时区的时间戳,并允许您为系统指定所需的精度。
为了获得1微秒的精度,相当于 PostgreSQL 中的 timestamp without time zone
,您需要指定6个分数位的精度,即:
datetime2(6)
datetime2(6)
来匹配PostgreSQL的精度。 - Sergey Kalinichenko