开发者

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

开发者 https://www.devze.com 2023-01-02 07:55 出处:网络
I\'m using CakePHP. When trying to insert a null value into a field it turns into 1900-01-01 00:00:00.

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

精彩评论

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