MySql table have two or more columns have default date vaule CURRENT_TIMESTAMP,any Solutions? -


if have table 2 columns create_time , update_time,the data type timestamp,then have default value current_timestamp,the sql code of created table is:

create table `t_activity` (   `id` int(11) not null auto_increment,   `startdate` timestamp not null default current_timestamp,   `enddate` timestamp not null default current_timestamp,   primary key (`id`) ); 

but prompt
error:1293,there can 1 timestamp column current_timestamp in default or update clause.

i not sure you're trying accomplish having both startdate , enddate populated current_timestamp. fix code try changing data types datetime this:

**create table `t_activity` (   `id` int(11) not null auto_increment,   `startdate` datetime not null default current_timestamp,   `enddate` datetime not null default current_timestamp,   primary key (`id`) );** 

http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-5.html


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -