5 messages in com.mysql.lists.mysqlLOAD DATA INFILE - skip some fields| From | Sent On | Attachments |
|---|---|---|
| Elvis | 06 Dec 1999 16:14 | |
| Elvis | 06 Dec 1999 16:16 | |
| Mr. Anthony R.J. Ball | 06 Dec 1999 16:35 | |
| Sasha Pachev | 06 Dec 1999 20:18 | |
| Don Read | 07 Dec 1999 18:00 |
| Subject: | LOAD DATA INFILE - skip some fields![]() |
|---|---|
| From: | Elvis (elv...@augustgroup.com) |
| Date: | 12/06/1999 04:14:03 PM |
| List: | com.mysql.lists.mysql |
I want to load a 300MB file once a week into a mysql table.
the format is like
"B",12323,"99",1,"description"
and so forth
so I do
LOAD DATA INFILE 'bigfile.txt' INTO TABLE mytable FIELDS TERMINATED BY ','
ENCLOSED BY '"'
it works, as long as the table is built out like:
+----------+-----------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------------------+------+-----+---------+-------+ | notused1 | char(1) | | | | | | field1 | mediumint(8) unsigned | | | 0 | | | notused2 | smallint(5) unsigned | | | 0 | | | field2 | smallint(3) unsigned | | | 0 | | | field3 | text | YES | | NULL | | +----------+-----------------------+------+-----+---------+-------+
That's how I get the data in there now, I have fields that I won't query on
(notused1, notused2) . However, to save space I would like to read in the file,
but skip over the first delimited info as well as the 3rd field in the text and
just enter in
12323 -> field1 1 -> field2 description -> field3
so I can drop the fields notused1, notused2 from the table.
I am unable to control the fact that the format of the text file includes the 2
other not needed fields.
If I do:
LOAD DATA INFILE 'bigfile.txt' INTO TABLE mytable FIELDS TERMINATED BY ','
ENCLOSED BY '"' (field1,field2,field3)
those fields are filled in, however, they are filled in with B, 12323, 99 instead of what I stated above.
Any suggestions?
Bill




