Dear mysql-ians,
I am using mysql 5.0 and I want to load a huge txt-file in my database.
My text file (file.txt) looks like:
col1 col2 col3 ... col200
col1 col2 col3 ... col200
....
col1 col2 col3 ... col200
I now want it to import in a table t1 with two columns (col_nr,
col_val) where col_nr is the number of column (e.g. 2 for col2, 46 for
col46) and col_val are the effective values in my txt-file at the
different columns. The problem is that col_nr is not in the "file.txt"
so I have to assign based on the field number.
I am looking at the LOAD DATA INFILE command, but in the help file I
did not find an answer to my question. I was hoping to do it with:
LOAD DATA INFILE 'file.txt'
INTO TABLE t1
(col_val)
SET col_nr = "how do I do this";
Does anyone has any suggestions or tips to do it differently (with php
perhaps)?
Thanks in advance!
Stef
I am using mysql 5.0 and I want to load a huge txt-file in my database.
My text file (file.txt) looks like:
col1 col2 col3 ... col200
col1 col2 col3 ... col200
....
col1 col2 col3 ... col200
I now want it to import in a table t1 with two columns (col_nr,
col_val) where col_nr is the number of column (e.g. 2 for col2, 46 for
col46) and col_val are the effective values in my txt-file at the
different columns. The problem is that col_nr is not in the "file.txt"
so I have to assign based on the field number.
I am looking at the LOAD DATA INFILE command, but in the help file I
did not find an answer to my question. I was hoping to do it with:
LOAD DATA INFILE 'file.txt'
INTO TABLE t1
(col_val)
SET col_nr = "how do I do this";
Does anyone has any suggestions or tips to do it differently (with php
perhaps)?
Thanks in advance!
Stef
Comment