var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help with Load Data Infile
I am trying to load a data file into a table. The table structure is as follows:
Col1 | col2 | col3 |
Col1 is auto incremented, primary key
My query is
LOAD DATA INFILE 'c:\\s.txt' INTO TABLE my_table (col2,col3);
I get a 1261 error (row 1 does not contain data for all columns) . Any guideline what i am doing wrong here.
could we have a look at the first few lines of data in the s.txt file, please
i think you may have forgotten to specify how the fields are separated
the default is a tab
Thanks for quick reply, The s.txt is like following.
Its tab. I have also tried using different seperators and specifying that with "Fields terminated by" and "lines terminated by" but its not working.
hmm, well, you must've converted your tabs to spaces when pasting here, because i don't see no tabs in those records
Originally Posted by sysenm
also, "its not working" is not enough information to go on
Originally Posted by r937
I am using the defaults (tab for field separation and end-of-line for line separation. I am getting the same error "row 1 does not contain data for all columns" over and over,
okay, here's an idea
grab the first dozen rows or so of your data, save as a text file, attach it to your post, and i'll test it here to see if i can get it working
Thank you r937 !
The file is attached. BTW, I am working on a windows machine.
well, it worked fine for me
i created a test table --
here's how i loaded it --
CREATE TABLE sysenm
( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT
, foo VARCHAR(99)
, bar DECIMAL(5.4)
and to prove i loaded it, i ran this query --
LOAD DATA INFILE 'C:/Documents and Settings/aldebaran.winxp/Desktop/s.txt'
INTO TABLE sysenm
FIELDS TERMINATED BY '\t'
( foo, bar )
which produced these results --
SELECT LEFT(foo,13) as qux
, COUNT(*) AS rows
, AVG(bar) AS avg_bar
, MAX(bar) AS max_bar
qux rows avg_bar max_bar
xxxContext601 4 0.83075000 0.8550
xxxContext602 4 0.85075000 0.8660
xxxContext603 3 0.84566667 0.8810
xxxContext604 3 0.86200000 0.8770
xxxContext605 3 0.83766667 0.8670
Thank you very much.
I 'll check my table defination, thats the only thing left to check now. Thanks again