I totally agree with the NULL/GETDATE()
answers.
As a general best practice, I would avoid storing special datetime values anywhere unless you are prepared to wrap them regularly. Because you end up with having to fix logic to add thresholds when DATEDIFF
s start to come out with thousands of months difference, etc.
The rule I go with for dates is never a special datetime value and NOT NULL
(by constraint/table definition) unless there is a need for a special reserved date value, then I try to use NULL
. If I need multiple reserved dates, I look at individual flag columns with NULL
for the datetime instead or joining to a date dimension instead of a datetime column (particularly in warehousing).
In your case with DateCreated
and DateModified
, I initialize both to GETDATE()
with column defaults. DateModified
typically gets refreshed in the UPDATE
trigger.