equivalent of PostgreSQL type "timestamp without time zone" in SQL Server

postgresql, sql, sql-server

Solution

For new development you can use the `datetime2` data type, not the "plain" `datetime`. It stores a timestamp with no time zone, and lets you specify the precision that you need for your system.

To get the precision of 1 microsecond, which is the equivalent of `timestamp without time zone` in PostgreSQL, you need to specify precision of 6 fractional digits, i.e.

datetime2(6)

See this answer for details on why Microsoft recommends using `datetime2`.

Problem

what is the type equivalent of postgresql "timestamp without time zone" in SQL Server? would it be ok to use DateTime?

Original source

Related problems