开发者

I can't insert NULL values into datetime2 fields in SQL Server

I'm using CakePHP. When trying to insert a null value into a field it turns into 1900-01-01 00:00:00.

Here's a sample of my code:

$this->save(array(
        'date_signed' => null
    ));

What seems to be the error a开发者_运维知识库nd how do I fix it? Thanks in advance!


SQL server does not appear to have a NULL date value, instead it uses a minimum value which is what you are seeing here. For standard SQL DateTime2 the minimum value is 0001-01-01 00:00:00

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜