Insert null/empty value in sql datetime column by default

后端 未结 5 585
死守一世寂寞
死守一世寂寞 2020-12-01 23:52

How do I create a table in SQL server with the default DateTime as empty, not 1900-01-01 00:00:00.000 that I get?

I mean, if there is no value inserted,

5条回答
  •  不思量自难忘°
    2020-12-02 00:41

    1. define it like your_field DATETIME NULL DEFAULT NULL
    2. dont insert a blank string, insert a NULL INSERT INTO x(your_field)VALUES(NULL)

提交回复
热议问题