After the Info table is created in MySQL, an error is displayed when inserting data, mainly in the addtime field. The related code is as follows: # Create a table createtableitem (...... Addtimedatenotnull, endtimedatenotnull ,...... # Insert data INSERTINTOitem (item_name, item_remark, item_desc, kind_id, addtime, endtime, init_price, max_price, owner_id,... mysql
After the Info table is created in MySQL, an error is displayed when inserting data, mainly in the addtime field. The related code is as follows:
# Table creation
Create table item (
......
Addtime date not null,
Endtime date not null,
......
# Insert data
Insert into item (item_name, item_remark, item_desc, kind_id, addtime, endtime, init_price, max_price, owner_id, winer_id, state_id)
VALUES ('mainboard ', 'old mainboard', 'old mainboard, you can also use ', 1, CURDATE ()-5, CURDATE () + INTERVAL 30 DAY, 230,250, 1, null, 1 );
I checked that the CURDATE () function can be used as a string or as a digital context. There are also examples of defining it as a Date type, so I initially thought the code is okay.
However, the following error still occurred on my computer after I entered it:
ERROR 1292 (22007): Incorrect date value: '20140901' for column 'addtime' at row 1
Please kindly advise