0

I am trying to load a CSV file into a MySQL table with the load data local statement. After loading it, the statement reports

Query OK, 1030 rows affected, 7314 warnings (0.03 sec)
Records: 1043  Deleted: 0  Skipped: 13  Warnings: 7314

Fur my purposes, skipping 13 records is not OK - I'd rather have the statement to fail with an error message.

As the load data local statement is found in an .sql file that I execute from a batch file, I'd also appreciate if there was a possibility to abort the execution of the batch file on the first error.

Is this somehow possible?

  • Show real query text. Does it includes LINES STARTING BY? – Akina Apr 25 at 10:53
  • From the docs (emphasis added), "If you do not specify either modifier, the behavior depends on whether the LOCAL modifier is specified. Without LOCAL, an error occurs when a duplicate key value is found, and the rest of the text file is ignored. With LOCAL, the default behavior is the same as if IGNORE is specified; this is because the server has no way to stop transmission of the file in the middle of the operation." – topshot Apr 25 at 12:34
  • Ok, I understand that the server cannot stop the transmission. But as far as I can see from the docu, there is no way to have a warning signalled as error (with LOCAL). – René Nyffenegger Apr 25 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.