MySQL 5.0.18
The field in question (bulk_body) is a text field, so it should not
have a limit anywhere near as low as 255.
CREATE TABLE `lead_bulk` (
`bulk_id` int(10) unsigned NOT NULL,
`bulk_batch_id` int(10) unsigned NOT NULL,
`bulk_source` int(10) unsigned NOT NULL default '0',
`bulk_body` text NOT NULL,
`bulk_cdate` datetime NOT NULL default '0000-00-00 00:00:00',
`bulk_import_date` datetime default NULL,
`bulk_lead_id` int(10) unsigned default NULL,
`bulk_header` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`bulk_id`),
FULLTEXT KEY `bulk_body` (`bulk_body`)
) ENGINE=MyISAM;
According to the documentation for LOAD DATA it does not support Text
or BLOB fields:
" Some cases are not supported by LOAD DATA INFILE:
Fixed-size rows (FIELDS TERMINATED BY and FIELDS ENCLOSED BY both
empty) and BLOB or TEXT columns. "
Thomas Bartkus wrote:
<gr******@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
So I need to load lots of data into my database.
So I discover LOAD DATA INFILE.
Great! This little gem loads my CSV in blazing times (compared to
parsing the file and doing INSERT for each row). Its still slow on
large files, but just barely acceptable.
Only one problem. It truncates fields to 256 characters, even on a
text field.
That makes it useless to me.
What options do I have?
The LOAD DATA INFILE is not truncating your strings!
One would strongly suspect that your field definition is what limits you to
255 characters.
Both CHAR and VARCHAR require that the maximum length be declared and both
have a maximum length of 255. I would venture a beer bet that says you are
truncating to 255 chars (not 256). VARCHAR(255) or CHAR(255) are common
declarations for fields containing text strings. Larger strings for these
field types are illegal. And whatever the declared length - MySQL will
simply truncate the extra characters without complaining.
You would need to move to a BLOB type for larger strings - which you
certainly can do if you need to store longer strings.
My bet is that it's your field declaration that limits you to 255 chars.
Show us a SHOW CREATE TABLE for the one you are trying to stuff with those
long strings.
Thomas Bartkus