phpmyadmin - Why won't MySQL let me remove attribute "on update CURRENT_TIMESTAMP"? -


i have table 2 timestamp fields. defined them name , type timestamp, yet reason mysql automatically set 1 of them default value , attribute on update current_timestamp. planning on having no default value in either of fields, 1 of fields called "date_updated" suppose set mentioned attribute field.

unfortunately, it's field "date_created" set on update current_timestamp attribute, , no matter do, mysql won't let me remove it.

i've tried editing "date_created" field , removing attribute. when clicking save, attribute back. have tried selecting both fields, removing attribute 1 of them , setting on other. gives me error #1293 - incorrect table definition; there can 1 timestamp column current_timestamp in default or on update clause , both attribute columns on values set on update current_timestamp result:

error sql query:  alter table  `pages` change  `date_created`  `date_created` timestamp not null , change  `date_updated`  `date_updated` timestamp on update current_timestamp not null  mysql said:   #1293 - incorrect table definition; there can 1 timestamp column current_timestamp in default or on update clause  

must recreate both columns in correct order fix this?

i know how solve problem correctly, future reference.

thanks


now i've tried run

alter table pages change date_created  date_created timestamp not null 

you should specify default current_timestamp (or default 0)

alter table pages change date_created date_created timestamp not null default 0, change  `date_updated`  `date_updated` timestamp on update current_timestamp not null 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -