0
votes

So I have a built a table and now need to upload a CSV. But I am getting a syntax error. I am new to a MariaDB server and HeidiSQL. Any help greatly appreciated. As I understand it HeidiSQL is basiclly the same as MySQL.

" You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LOAD DATA [LOCAL] INFILE 'C:/Users/aline.kasliner/Desktop/MyStuff/Mullenserverw' at line 4 / / Affected rows: 0 Found rows: 0 Warnings: 0 Duration for 0 of 1 query: 0.000 sec. */ "

    LOAD DATA [LOCAL] INFILE  'C:/Users/aline.kasliner/Desktop/MyStuff/Mullenserverwork/DisplayMediaData.csv'
    INTO TABLE Duke_Display_Media_Data
    OPTIONALLY FIELDS TERMINATED BY ',' 
    ENCLOSED BY '"'
    LINES TERMINATED BY '\n'  
    ignore 1 rows
    (date_
    ,campaign 
    ,site  );
1

1 Answers

0
votes

In the documentation the [LOCAL] part refers to an optional directive. The square brackets are not present in the final command, they're just the notation for indicating that part may or may not be present.

The command should be:

   LOAD DATA LOCAL INFILE ...

When you see notation like X [A|B|C] Y that means one of A, B or C may be present, or they can be omitted altogether. Likewise, X [A] [B] [C] Y means that any of A, B, or C can be included, but they should be in that order, so X A B Y is valid, but X C A A Y is not.