Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing data with load file

Status
Not open for further replies.

minckle

Programmer
Mar 17, 2004
142
GB
is it possible to run the command below with variable values i.e putting %1, %2 in for the file name

This works fine:

load data local infile c:/contacts.txt into table itextit.import_contacts fields terminated by ',' lines terminated by '\r\n'(%1, surname, mob_number);

but i can't get this working, it is possible

load data local infile %1 into table itextit.import_contacts fields terminated by ',' lines terminated by '\r\n'(%1, surname, mob_number);
 
I do not believe it's possible because the "load data infile" (just as mysqlimport) is a "bulk" loader that reads text files only. You may want to write a short script that will populate your "infile" with the data for the variables prior to the "load data infile" process.
WR.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top