column called “jdate” defined “varchar(19), , before insert rows table called “fatable”
alter table fatable change jdate jdate timestamp null default current_timestamp; then, inserting row like: insert fatable (firstname,lastname, address, city, state, zip, phoneno, emailad, jdate, ddate, cstatus, investam, wamount, comments) values('john','lee','10 rustling lane','bedford','ny','10506','9142347752','support@poosung.com', '','09262015','0','100','10','aa');
the result:
# id, firstname, lastname, address, city, state, zip, phoneno, emailad, timestamp, ddate, cstatus, investam, wamount, comments '2015101', 'john', 'lee', '10 rustling lane', 'bedford', 'ny', '10506', '9142347752', 'support@poosung.com', '0000-00-00 00:00:00', '09262015', '0', '100.00', '10.00', 'aa'
the column “jdate” has mysql date format zeroes. no current date shown.
we don't see reference changed jdate
column in result. (there's column named timestamp
, column named ddate
).
the mysql reference manual covers topic of automatic initialization of timestamp column well.
some possible causes behavior observing: timestamp column allows null value, value timestamp column supplied/assigned in insert, more 1 timestamp column in table, etc.
there's not enough information provided in question provide exact answer. alter table
statement references column named jdate
, don't see reference column in insert (which we'd expect if want value automatically initialized), confusingly, result doesn't show column named jdate
.
reference: https://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html