Question Locked

MySQL LOAD DATA INFILE not working as the manual says it should.

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can anyone tell me what's wrong with this? I've been looking at it for ages, and posted it on the MySQL forum - but no response yet. It worked until I added the field names as in the table I have an ID column and timestamp column that are automatically generated and this was overwriting them. What it's complaining about are the TERMINATION sections:

C:\SCRIPTS\MySQLupload.vbs(20, 1) Microsoft OLE DB Provider for ODBC Drive
rs: [MySQL][ODBC 3.51 Driver][mysqld-5.0.37-community-nt]You have an error in yo
ur SQL syntax; check the manual that corresponds to your MySQL server version fo
r the right syntax to use near 'fields terminated by ',' LINES TERMINATED BY'#''
at line 1

Sorry the above looks bad - cmd line Windows-style! It's a VB Script, and was working... Been staring at the MySQL manual online till my eyes went funny, can't see the problem. And I do have FILE priviledges set on the server. I have a data export from SQL Server using bcp into a csv file, then import it into a MySQL reporting database using the script below:

Dim dbCON
Set dbCON = CreateObject("ADODB.Connection")
dbCON.Open "DSN=reporting"
dbCON.Execute "LOAD DATA INFILE 'c:/scripts/mysql/export.csv' INTO TABLE pd_rpt.rpt_main (SITE, PRESS, JOB_NAME, JOB_DESC, JOB_ORDER, SCHED_START,
SCHED_END, ACTUAL_START, ACTUAL_END, WEB_BREAKS) fields terminated by ',' LINES TERMINATED BY'#'"

dbCON.Close

set dbCON = Nothing

This will be used to import data from a variety of databases running on Linux and Windows, so a csv works well for what I need.

1 reply

This discussion is closed to new replies.