0

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!

Edited by Benjamin_11

2
Contributors
2
Replies
13
Views
3 Years
Discussion Span
Last Post by Benjamin_11
0

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?

0

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)";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.