From: Mat Schaffer Date: 2007-01-03T00:31:25+09:00 Subject: Re: how to concanate this mysql query? On Jan 2, 2007, at 6:45 AM, rajibsukanta wrote: > could any pl suggest me how to create this mysql query string in ruby? > > I have a directory c:\mooney.com\NSEDATA\ > > inside i have a couple of csv files that i need to update onto > database > of nsehistory. > [snip: code setup] > > if f.include? "csv" > with_db do |db| > csv_name = "c:\\mooney.com\\NSEDATA\\#{f}" > res = db.query("load data infile #{csv_name} into table > nsehistory fields terminated by ',' > lines terminated by '\n' ignore 1 lines") > res.free > end > > end > end > > But this returns me saying MYSQL syntax error This looks like more a of a mysql problem. But I think you need to put '' around your file name like this: res = db.query("load data infile '#{csv_name}' into table nsehistory fields terminated by ',' lines terminated by '\n' ignore 1 lines") -Mat