DateTime2 vs DateTime in SQL Server

前端 未结 14 1332
谎友^
谎友^ 2020-11-22 06:04

Which one:

  • datetime
  • datetime2

is the recommended way to store date and time in SQL Server 2008+?

I\'m aware of differ

14条回答
  •  梦谈多话
    2020-11-22 06:52

    while there is increased precision with datetime2, some clients doesn't support date, time, or datetime2 and force you to convert to a string literal. Specifically Microsoft mentions "down level" ODBC, OLE DB, JDBC, and SqlClient issues with these data types and has a chart showing how each can map the type.

    If value compatability over precision, use datetime

提交回复
热议问题