I am trying to load a file from a Notepad .txt file into a table.
Here is a sample of the data,
VARCHAR_Field_1**VARCHAR_Field_2**VARCHAR_Field_3**VARCHAR_Field_4
Here is my SQL,
LOAD DATA INFILE 'C:\\Documents and Settings\\MyUser\\My Documents\\etc\\MyNotepadTextFile.txt'
INTO TABLE My_Table
FIELDS TERMINATED BY '**'
(Field_1, Field_2, Field_3, Field_4)
I first got an error "ERROR 1406 (22001): Data too long for column "Field_1' at row 1" which suggested to me that the field terminators were not being observed and I stretched the VARCHAR column to allow huge fields and tried again and got the second error confirming my suspicions, "ERROR 12661 (01000): Row 1 doesn't contain data for all columns"
What should I be using for my LOAD DATA INFILE command to get this data in?
Here is the table I am using:
DROP TABLE IF EXISTS `My_Table`;
CREATE TABLE `My_Table` (
`TNID` int(10) unsigned NOT NULL auto_increment,
`Field_1` varchar(200) NOT NULL default '',
`Field_2` varchar(45) NOT NULL default '',
`Field_3` varchar(45) NOT NULL default '',
`Field_4` varchar(400) NOT NULL default '',
PRIMARY KEY (`TNID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Edited 3 time(s). Last edit at 04/20/2010 01:13PM by Paul Pikowsky.