Im using the following query with LOAD DATA INFILE:

"LOAD DATA LOCAL INFILE 'file.csv'
INTO table mgap_export
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
IGNORE 3 LINES
(@dummy,@dummy,@dummy,@dummy,Full_Name,gt_accountMgrID,Email_Address,mgap_ska_id,@gtdashboardLink,
@gt_rankingLink, @gt_analyticsLink)

SET gtdashboardLink=CONCAT('http://www.url.com/logind.php?id=',gt_accountMgrID),
SET gt_rankingLink=CONCAT('http://www.url.com/logind.php?id=',gt_accountMgrID)";

If I remove the last variable the query works just fine, but I keep getting a syntax error when I leave it in.

Can anyone see where Ive gone wrong? All columns and names have been verifed to NOT be the issue. I know it has to be one of those simple issues that you cannot see until you post it and feel like an idiot when someone else points it out, but, so be it!

Recommended Answers

All 2 Replies

Are you referring to the last variable as being @gt_analyticsLink in your column list? Because you don't have a matching SET statement for it.
Or do you mean you remove the SET line for gt_rankingLink and it works?

Thanks for your comments. I actaully tried that before i posted and inadvertablty left it out of my post. Here is the revised code:

  INTO table mgap_export
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
  LINES TERMINATED BY '\n'
  IGNORE 3 LINES
                   (@dummy,@dummy,@dummy,@dummy,Full_Name,gt_accountMgrID,Email_Address,mgap_ska_id,gt_pass,@gtdashboardLink,@gt_rankingLink, @gt_analyticsLink)

SET gtdashboardLink=CONCAT('http://www.url.com/logind.php?id=',gt_accountMgrID),
SET gt_rankingLink=CONCAT('http://www.url.com/loginr.php?id=',gt_accountMgrID),
SET gt_analyticsLink=CONCAT('http://www.url.com/logina.php?id=',gt_accountMgrID)";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.