there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
2016-08-12 00:26
701 查看
建表语句:
测试:
参考这里:
http://stackoverflow.com/questions/267658/having-both-a-created-and-last-updated-timestamp-columns-in-mysql-4-0
create table test_table( id integer not null auto_increment primary key, stamp_created timestamp default '0000-00-00 00:00:00', stamp_updated timestamp default now() on update now() ); |
[code]mysql> insert into test_table(stamp_created, stamp_updated) values(null, null); Query OK, 1 row affected (0.06 sec) mysql> select * from t5; +----+---------------------+---------------------+ | id | stamp_created | stamp_updated | +----+---------------------+---------------------+ | 2 | 2009-04-30 09:44:35 | 2009-04-30 09:44:35 | +----+---------------------+---------------------+ 2 rows in set (0.00 sec)
mysql> update test_table set id = 3 where id = 2; Query OK, 1 row affected (0.05 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from test_table; +----+---------------------+---------------------+ | id | stamp_created | stamp_updated | +----+---------------------+---------------------+ | 3 | 2009-04-30 09:44:35 | 2009-04-30 09:46:59 | +----+---------------------+---------------------+ 2 rows in set (0.00 sec)
参考这里:
http://stackoverflow.com/questions/267658/having-both-a-created-and-last-updated-timestamp-columns-in-mysql-4-0
相关文章推荐
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- [Err] 1293 - there can be only one TIMESTAMP column with CURRENT_TIME in DEFAULT or ON UPDATE clause
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- 数据库建表 there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- msyql同步的时候报错 : 错误代码: 1293 Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT
- Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAUL
- 1293 - Incorrect table definition; there can be only oneTIMESTAMP column with CURRENT_TIMESTAMP
- error : Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in
- Mysql 1293 - Incorrect table definition; there can be only one TIMESTAMP column with C
- mysql单表多timestamp报错#1293 - Incorrect table definition; there can be only one TIMESTAMP column with C
- Mysql [Err] 1293 there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
- [Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON
- MySQL 数据表创建报错:there can be only one auto column and it must be defined as a key
- convert doc with images in to wiki format can only be on linux
- 创建主键时报错:ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it mus
- mysql报there can be only one auto column的问题原因
- 解决,Incorrect table definition; there can be only one auto column and it must be defined as a key