1
votes

I have datetime column(test_date) with default value set to current_timestamp

but when Update the table it shows

Error in Updation Query
Incorrect datetime value: '' for column 'test_date' at row 1

I even changed the column type to timestamp but still it throws the same error

Error in Insertion Query insert into tbl_testimonials(test_title,test_image,test_content,test_date,status) values('hi','','this is checking','', 'Y') Incorrect datetime value: '' for column 'test_date' at row 1

My question is different : the question in MySQL CURRENT_TIMESTAMP on create and on update discuss about having to timestamp values in the same table and the error is

ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

But I have a single column with timestamp value and my error is

Incorrect datetime value: '' for column 'test_date' at row 1

So I think my question is different

Please help

1
set default value to current_timestamp - shubham715
Show us your update statement please. - Quality Catalyst
@scriptkiddie Can you show your update query? - Milan Gupta
@S.I. thx for the lookup - Drew
@Milan Gupta bro I have updated my question with the query bro with new value - scriptkiddie

1 Answers

2
votes

If you want mysql to do it for you then don't include test_date in your key values. So it should go something like below:

tbl_testimonials  
(test_title,test_image,test_content,status) values  
('hi','','this is checking', 'Y')