MySQL Forums :: Newbie :: Using a Parameter in Load Data Infile Command (Instead of direct filename)


Advanced Search

Using a Parameter in Load Data Infile Command (Instead of direct filename)
Posted by: Dhaval Sheth ()
Date: July 27, 2009 06:15AM

Hello,

I was wondering if we can have a parameter passed to the load data infile command rather than direct file name

Something like:

load data infile @input_file_name into table tab_name
fields terminated by '|'
lines terminated by '\n'
ignore 1 lines
(@dummy1, @dummy2)
set col1 = trim(@dummy1),
col2 = trim(@dummy2); show warnings;

and @input_file_name = 'c:/test/file1.txt'



I have tried following things but with no luck:


1.
set @input_file_name = 'c:/test/file1.txt';
load data infile @input_file_name into table tab_name....


2.set @input_file_name = 'file1.txt';
select @input_file_name;
load data infile concat('c:/test/',@input_app_file_name) into table....

What I want is my file1.txt or maybe entire path 'c:/test/file1.txt' should be given as parameter to load data infile.


Please let me know other possibilities.

Thanks,
Dhaval

Options: ReplyQuote


Subject Written By Posted
Using a Parameter in Load Data Infile Command (Instead of direct filename) Dhaval Sheth 07/27/2009 06:15AM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Peter Brawley 07/27/2009 07:17AM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Dhaval Sheth 07/29/2009 12:09AM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Jay Alverson 07/29/2009 09:53AM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Jay Alverson 07/27/2009 02:15PM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Dhaval Sheth 07/28/2009 11:37PM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Peter Brawley 07/29/2009 12:59AM
Re: Using a Parameter in Load Data Infile Command (Instead of direct filename) Dhaval Sheth 10/22/2009 01:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.