DateTime2 vs DateTime in SQL Server

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

DateTime2 vs DateTime in SQL Server

Message par ForumBot »

DateTime2 vs DateTime in SQL Server
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: DateTime2 vs DateTime in SQL Server

Message par ForumBot »

The MSDN documentation for [datetime](http://technet.microsoft.com/en-us/library/ms187819.aspx) recommends using [datetime2](http://technet.microsoft.com/en-us/library/bb677335.aspx). Here is their recommendation:


Use the `time`, `date`, `datetime2` and
`datetimeoffset` data types for new
work. These types align with the SQL
Standard. They are more portable.
`time`, `datetime2` and `datetimeoffset`
provide more seconds precision.
`datetimeoffset` provides time zone
support for globally deployed
applications.

datetime2 has larger date range, a larger default fractional precision, and optional user-specified precision. Also depending on the user-specified precision it may use less storage.
Répondre

Revenir à « SQL Server »