Bug #39115 Permit a variable in filename parameter of LOAD DATA INFILE
Submitted: 29 Aug 2008 10:38 Modified: 31 Aug 2008 17:05
Reporter: Albert Rovira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: LOAD DATA INFILE

[29 Aug 2008 10:38] Albert Rovira
Description:
The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. The filename must be given as a literal string. 

It would be more useful if a variable can specify the filename.

select filename  into @tt from filename_table;
LOAD DATA INFILE @tt INTO TABLE dirnets

How to repeat:
Permit this:

select filename  into @tt from filename_table;
LOAD DATA INFILE @tt INTO TABLE dirnets
[31 Aug 2008 17:05] Valeriy Kravchuk
Thank you for a reasonable feature request.
[18 Feb 2009 19:05] Sveta Smirnova
Duplicate of bug #42976
[26 Aug 2011 23:24] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=61984 marked as duplicate of this one.
[22 Nov 2011 1:14] Daniel Thom
I would also love this functionality as it would avoid the need to write scripts/programs *just* to be able to do this one small thing where I need the filename parameterized.
[20 Mar 2012 19:17] David Berg
I add my vote to implementing this feature request. Thank you!
[21 May 2012 15:25] Dylann Cordel
+1.
It would be very usefull.
[23 Apr 2013 15:36] Jonathan Bishop
I'd like this too.
[5 Oct 2013 20:55] Aleksandar Matejic
This should have been almost a basic feature. I need to make changes in my MySQL procedure for every .csv file with different file name, instead of just pass the file name as the parameter. 

Is this going to be solved ever?
[18 Feb 2014 18:00] Ben Lin
vote for this feature.
[15 May 2014 11:17] Natalie Selin
This is definitely a feature that would be very useful.
[7 Jul 2014 10:35] V S
Hi Team

May I know what are the work-around?  I have 100 diff files to load from 100 diff customers. I made generic shell script and created generic mysql file. After wasting 4 hrs, come to know that LOAD DATA INFILE does not accept PARAMETERS..what a waste.. 

Admin, any chances for implementing this long awaited feature?

Thanks
Vishal Shah
[27 Oct 2015 14:35] IGG t
Is there any sign of this happening. It seems such an obvious thing that to do? Yet at the same time probably accounts for a huge increase in workloads trying to 'work around' the problem.
[12 Jan 2016 0:35] Josh Klein
This seems ridiculous. It's been 7 years since this has been submitted. Many feel it's an obvious feature and a reasonable request. Status is marked Verified and it's modified date is 2 days after it was opened. It seems clear to me the status of this bug is wrong unless I'm missing something....
[3 Oct 2016 11:35] Swapnil Jadhav
IS this feature present in the MySQL version 5.7
[22 Jan 2017 8:41] Tanel Consultant
Hello MySQL team! 

I would very very much also need this feature to be added to the backlog.

Ability to dynamically declare upload file names and tables names in the LOAD DATA INFILE would truly save anyone from a huge timespend in manually repeating and duplicating code only for the purpose of naming "explicit" filenames.

Kindly requesting this feature.
[21 Apr 2018 12:16] Ema Re
Please I need "LOAD XML LOCAL INFILE @xxx" too. Thanks