12

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

would it be ok to use DateTime?

user441365
  • 3,934
  • 11
  • 43
  • 62

1 Answers1

13

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.

Community
  • 1
  • 1
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523