2

I have been making tables with a modified row which is time stamped.

`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

I am seeking to rename this as bookedinand timestamp the day of entry into the database.

i have looked on the net for a solution at sites like http://www.w3schools.com/sql/func_curdate.asp

And cant seem to find a solution that works or is what i need.

I tried to edit it in the databse myself but with no luck. as you can tell im a extremity novice

4

1 回答 1

0

而不是 w3schools,你真的应该使用实际的 MySQL 文档。http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

 alter table tablename change `modified` `bookedin` timestamp NOT NULL DEFAULT
 CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

或者也许只是

 alter table tablename change `modified` `bookedin` timestamp NOT NULL DEFAULT
 CURRENT_TIMESTAMP;

我认为 on update 可能只是时间戳数据类型的一部分。而且,我认为更改表的名称可能会导致所有行将其时间戳更新为您执行此操作的日期。因此,您可能想要复制该表并先尝试一下。我记得曾经遇到过这样的问题,这让我从使用 TIMESTAMP 切换到了 DATETIME。

于 2013-08-20T23:45:18.380 回答