gpt4 book ai didi

MYSQL修改表current_time默认错误

转载 作者:行者123 更新时间:2023-11-29 21:01:57 25 4
gpt4 key购买 nike

我尝试通过插入新属性 date1 来更改表,它将自动设置表中每个条目的日期。

当我插入查询时

ALTER TABLE `vessellist` ADD `date1` DATE NOT NULL DEFAULT CURRENT_TIMESTAMP FIRST;

它说日期1的默认值无效

最佳答案

The DEFAULT clause specifies a default value for a column. With one exception, the default value must be a constant; it cannot be a function or an expression. This means, for example, that you cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE. The exception is that you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP column

http://dev.mysql.com/doc/refman/5.5/en/create-table.html

关于MYSQL修改表current_time默认错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37144628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com