Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

what is the type equivalent of postgresql "timestamp without time zone" in SQL Server?

would it be ok to use DateTime?

like image 333
user441365 Avatar asked Feb 20 '14 16:02

user441365


1 Answers

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.

like image 126
Sergey Kalinichenko Avatar answered Sep 20 '22 16:09

Sergey Kalinichenko