Reputation: 1097
I got the error saying:
ERROR 1064 (42000): 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 '
@my_directory + @my_file INTO TABLE mytable FIELDS TERMINATED BY ',' E
' at line 1
for the following code:
Set @my_directory = 'my directory';
Set @my_file = 'my file.csv';
LOAD DATA INFILE @my_directory + @my_file
INTO TABLE mytable
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n' IGNORE 1 LINES;
I want to have a seperate directory and file variable, concat them, get the full filename and load a file.
I also tried concat(@my_directory, @my_file1)
but still got the same error.
I am using MySQL 5.6 with MySQL Workbench.
Upvotes: 0
Views: 648
Reputation: 377
I think MySQL does not support it.
https://stackoverflow.com/a/14905351/3662004
http://bugs.mysql.com/bug.php?id=39115
Upvotes: 1