Possible duplicates:
I am trying to create table form
create table meritable 1 (id INT, date_validated TIMESTAMP, date_registered TIMESTAMP null default not CURRENT_TIMESTAMP);
Although this is not working I get an error
incorrect table definition;
When I change two timestamp statements (shown below) then it is working.
Create table myTable1 (id INT, date_registered TIMESTAMP tap default CURRENT_TIMESTAMP, date_validated TIMESTAMP); P> DIT>
TIMESTAMP is actually identical a DATETIME, but you declare TIMESTAMP for the first time, automatic Starts:
So when you first write TIMESTAMP without attributes, MySQL adds it internally to "DEFAULT CURRENT_TIMESTAMP". When MySQL encounters TIMESTAMP for the second time, where you explicitly set CURRENT_TIMESTAMP, then goes into conflict.
If you define CURRENT_TIMESTAMP in the first row, however, it is redundant - and since you do not specify anything on the second number, the second is not assigned any default and in conflict Does not go.
From the link above, "it need not be the first TIMESTAMP column in a table that is updated automatically start or current timestamp. Automatic start or update a TIMESTAMP column Specify, you must suppress automatic properties for the first time. "
Comments
Post a Comment