gpt4 book ai didi

mysql - 现在在 mysql 5.6 中使用 near '() 的正确语法是什么?

转载 作者:行者123 更新时间:2023-11-29 04:45:11 24 4
gpt4 key购买 nike

好吧,我已经在这方面工作了一段时间了,需要一些帮助。谢谢!

ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() now,

`Body` TEXT NULL,

`Created` TIMESTAMP NULL COMMENT 'This descrbes th' at line 2



CREATE TABLE IF NOT EXISTS `Newsletters` (

`Subject` INT NOT NULL DEFAULT () now,

`Body` TEXT NULL,

`Created` TIMESTAMP NULL COMMENT 'This descrbes the newsletter.',

PRIMARY KEY (`Subject`))

ENGINE = InnoDB



SQL script execution finished: statements: 36 succeeded, 1 failed



Fetching back view definitions in final form.

Could not get definition for ABC_Blue.view1 from server

1 views were read back.

最佳答案

括号放错了,试试

 DEFAULT now(),

但是你现在想要一个 INT 列的默认值?也许是时间戳列,在那种情况下你可以:

Created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

看这里即使字段是datetime,还是不能设置默认为NOW。

Docs

关于mysql - 现在在 mysql 5.6 中使用 near '() 的正确语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20203131/

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