I am having issue with setting a date to 1002-01-01 when null in SQL Server because it’s out of range.
To get around it, use the DATEFROMPARTS function (available from SQL Server 2012) and it mustĀ use datetime2 data type (datetime won’t work). An example is shown below.
CAST(DATEFROMPARTS(1002, 01, 01) AS DATETIME2)