I'm trying to import some data to database using: load data infile.
For example:
I have table (name: tab) with two columns: colA, colB.
In file there are three columns, example file content: value1|value2|value3
I want that value2 goes to colA and value3 goes to colB. I don't need value1.
In Mysql 5 I did it like this:
LOAD DATA INFILE <filename>
REPLACE
INTO TABLE tab
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\r'
(@dummy, colA, colB);
It works great but the problem is when I try do it in Mysql 4. There is an 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, colA, colB)' at line 6
I checked in mysql documentation: http://dev.mysql.com/doc/refman/4.1/en/load-data.html and in mysql 4 values from file can't be save to user variable (in my example to @dummy).
Do you have any ideas how to import (using load data infile) only some columns from file in Mysql 4?
Thanks