CDbCommand failed to execute the SQL statement: SQ

Hi,
 
I am receiving this error at step number 7 Migrate Sales. Please tell me how can I fix it and migrate sales.

CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘0000-00-00 00:00:00’ for column ‘converted_at’ at row 1

 

3 answers

Profile photo of Mall Staff 167790.00 $tone August 13, 2020
Public

Hi there,

CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘0000-00-00 00:00:00’ for column ‘converted_at’ at row 1

That issue occurred because your M1 database had the bad data in the value of the `converted_at` field. It may relate to the `sales_flat_quote` table.
 
Please run the data migration in step #7 using this CLI command:
php -f bin/ubdatamigration run --step=7

And then provide me more details of the error message you get. I will check further and get back to you then.

Regards,
Mall.

#1
Profile photo of Mall Staff 167790.00 $tone August 13, 2020
Public

Hi there,

View post on imgur.com

That is a bad data case in the ‘sales_flat_quote.converted_at’ table. 

To resolve, you can try with these steps:

1. Open the PHP file at ub-tool/protected/controllers/Step7Controller.php
and find the code line (Please note that there are two lines with the following code in the file, you need to replace both lines of code):

if (!$quote2->save()) {

and replace it with: 

if ($quote2->converted_at === '0000-00-00 00:00:00') {
$quote2->converted_at = null;
}
if (!$quote2->save()) {

2. Once done, you can continue with the data migration in step #7 using this command: 
php -f bin/ubdatamigration run --step=7

Regards,
Mall.
 
 

#3

Please login or Register to Submit Answer

Written By

Comments