Note that there are some explanatory texts on larger screens.

plurals
  1. POI get a syntax error on local infile import
    text
    copied!<p>I'm trying to do an update in MySQL using a local CSV file, am convinced that my syntax should be right, but am obviously missing something since MySQL tells me:</p> <blockquote> <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FIELDS TERMINATED BY ',' ENCLOSED BY '"' ( ArtikelNummer, Tags ) LINES TERMINA' at line 3</p> </blockquote> <p>The code I use is the following:</p> <pre><code>CREATE TEMPORARY TABLE TempTable LIKE Assortiment; LOAD DATA LOCAL INFILE 'C:\\Users\\Website\\website data\\stock.csv' INTO TABLE TempTable ( ArtikelNo, Tags ) FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n'; UPDATE assortiment INNER JOIN TempTable ON TempTable.ArtikelNo = assortiment.ArtikelNo SET assortiment.Tags = TempTable.Tags; DROP TEMPORARY TABLE TempTable; </code></pre> <p>The target table uses a lot of columns, the csv file only 2</p> <p>I'm think the error is in the column specification ( ArtikelNo, Tags ), because when I leave that away there is no syntax error anymore (only a wrong mapping). I tried putting this at different locations, made sure the column names are correct, but that didn't help.</p> <p>Obviously a work around would be to make sure the columns of the CSV are in the right order and put in some dummy columns where needed, but I want to find out why this goes wrong.</p> <p>I'm using MySQL query browser, version 5.1.11, Using server version 5.5.20.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload