Vaak puur uit gemak of zonder bij na te denken, helemaal niet erg! Tijd voor verandering.
Sinds SQL Server 2008 is ‘DateTime2‘ erbij gekomen en deze heeft toch wel een aantal voordelen.

Bron: https://stackoverflow.com/questions/1334143/datetime2-vs-datetime-in-sql-server/1334193
The MSDN documentation for datetime recommends using datetime2. Here is their recommendation:
Use the
time,date,datetime2anddatetimeoffsetdata types for new work. These types align with the SQL Standard. They are more portable.time,datetime2anddatetimeoffsetprovide more seconds precision.datetimeoffsetprovides 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.
DATETIME2has a date range of “0001 / 01 / 01” through “9999 / 12 / 31” while theDATETIMEtype only supports year 1753-9999.
DateTime2(3) have the same number of digits as DateTime but uses 7 bytes of storage instead of 8 byte
Tegenwoordig staat ook VARCHAR() vs NVARCHAR() ter discussie, en vooral het wel of niet gebruiken van specifieke lengtes voor ‘strings’ (zoals NVARCHAR(150) vs NVARCHAR(4000)). Join the discussion 🙂
Nieuwsgierig naar de mogelijkheden van Azure en DevOps binnen uw organisatie?
Neem dan contact met ons op: clint.huijbers@monkeyconsultancy.nl

