Balasubramani Samiyappan Balasubramani Samiyappan -4 years ago 215
MySQL Question

Mysql Bulk insert predefined function not working, SQL Error (1292): Truncated incorrect date value

Actual Table

assets_tag | purchase_date
---------- | ------
ABCD123 | 11/02/2015 00:00:00
ABCD456 | 29/03/2015 00:00:00


Normal select query

select assets_tag, str_to_date(purchase_date, "%d/%m/%Y" );


assets_tag | purchase_date
---------- | ------
ABCD123 | 2015-02-11
ABCD456 | 2015-03-29


if I run it's converted and displayed correctly. but creating a temporary table it's show error SQL Error (1292): Truncated incorrect date value

create TEMPORARY table temp as select assets_tag, str_to_date(purchase_date, "%d/%m/%Y" );


Thanks

Answer Source

try this:

STR_TO_DATE(purchase_date, "%d/%m/%Y  %H:%i:%s");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download