How exactly you're inserting null? NULL should work fine, e.g. insert into myTable (MyDateTimeColumn) values (NULL)
Empty '' string converts to '1900-01-01' by default.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When I insert NULL or empty string in a nullable SmallDateTime field; it inserts 1900-01-01 00:00:00
How do I set it to either empty or null?
How exactly you're inserting null? NULL should work fine, e.g. insert into myTable (MyDateTimeColumn) values (NULL)
Empty '' string converts to '1900-01-01' by default.
Insert NULL works as expected and an empty string gets contered to 1900-01-01, it's the smallest possible date value for smalldatetime
declare @test table(myDate smalldatetime NULL);
insert into @test (myDate) values (NULL);
insert into @test (myDate) values ('');
select *
from @test