Insert null/empty value in sql datetime column by default

后端 未结 5 563
死守一世寂寞
死守一世寂寞 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:32

    you can use like this:

    string Log_In_Val = (Convert.ToString(attenObj.Log_In) == "" ? "Null" + "," : "'" + Convert.ToString(attenObj.Log_In) + "',");
    

提交回复
热议问题