• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need MySQL LOAD DATA help

For the MySQL experts out there. I have a pipe delimited data file I am trying to load into a MySQL 4 database. The number of and order of columns are different between the data file and the table. The text file has more fields than I need to move into my database, and not every column of the database will be filled. This is because the database was created to handle alot of different types of pipe delimited and CSV files.

I am trying to use the LOAD DATA INFILE command to copy the text file in. I think I have the format right for the command, but then I also think I was reading a mySQL 5 book when I wrote it. In mySQL 5 it is supposed to look like this :


LOAD DATA INFILE 'C:\\Program Files\\xampp\\htdocs\\data\\data.txt'
INTO TABLE marketing.products
FIELDS terminated by "|"
LINES terminated by "\n"
(skuid, productname, @dummy, @dummy, buyurl, picturelinksmall, picturelinklarge, priceretail,
@dummy, category1, category2, desclong, category3, category4, category5, @dummy,
yearmade, @dummy, productstatus )

--

When I Run that I get the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@dummy, @dummy, buyurl, picturelinksmall, picturelinklarge, priceretail,
@d' at line 5

I think that has to do with the @dummy variable being used in MySQL 5 and it is not allowed in mySQL 4. For the life of me I cannot figure out how to get this done in mysql 4.
Does anybody know how to do this? I'd much rather use the LOAD DATA command than use PHP to build and execute the individual INSERT statements.

TIA,
Patrick
:|
 
perhaps you are missing a semicolon at the end ? Not familar with loading data in mysql but in oracle, you just use the "@" command and then give the file .sql file name
 
Back
Top