Description:
I am reading a information from a file and inserting in a table using LOAD DATA INFILE, the procedure works with no problem, but after I apply the same procedure the sequencing of the AUTOINCREMENT field jump some numbers.
This is a example data I have in a file called lin.txt
1,1,100,2011-09-21,2011-06-15,2011-10-03,2011-10-03
1,2,87,2011-09-12,2011-06-17,2011-10-03,2011-10-03
1,3,105,2011-09-16,2011-06-17,2011-10-03,2011-10-03
1,4,98,2011-09-18,2011-06-17,2011-10-03,2011-10-03
1,5,97,2011-09-23,2011-06-17,2011-10-03,2011-10-03
The table have 8 columns, where the first one is Autoincrement
So I execute this:
LOAD DATA INFILE 'lin.txt'
INTO TABLE tbl1
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(c1, c2, c3, c4, c5, c6, c7);
And after make a query get this:
1,1,1,100,2011-09-21,2011-06-15,"2011-10-03 00:00:00",2011-10-03
2,1,2,87,2011-09-12,2011-06-17,"2011-10-03 00:00:00",2011-10-03
3,1,3,105,2011-09-16,2011-06-17,"2011-10-03 00:00:00",2011-10-03
4,1,4,98,2011-09-18,2011-06-17,"2011-10-03 00:00:00",2011-10-03
5,1,5,97,2011-09-23,2011-06-17,"2011-10-03 00:00:00",2011-10-03
If you see the first column have the Id of the table which are okay (1,2,3,4,5)
No problem until now, but If I execute again the sentence:
LOAD DATA INFILE 'lin.txt'
INTO TABLE tbl1
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(c1, c2, c3, c4, c5, c6, c7);
and make a query over the table I get this
1,1,1,100,2011-09-21,2011-06-15,"2011-10-03 00:00:00",2011-10-03
2,1,2,87,2011-09-12,2011-06-17,"2011-10-03 00:00:00",2011-10-03
3,1,3,105,2011-09-16,2011-06-17,"2011-10-03 00:00:00",2011-10-03
4,1,4,98,2011-09-18,2011-06-17,"2011-10-03 00:00:00",2011-10-03
5,1,5,97,2011-09-23,2011-06-17,"2011-10-03 00:00:00",2011-10-03
8,1,1,100,2011-09-21,2011-06-15,"2011-10-03 00:00:00",2011-10-03
9,1,2,87,2011-09-12,2011-06-17,"2011-10-03 00:00:00",2011-10-03
10,1,3,105,2011-09-16,2011-06-17,"2011-10-03 00:00:00",2011-10-03
11,1,4,98,2011-09-18,2011-06-17,"2011-10-03 00:00:00",2011-10-03
12,1,5,97,2011-09-23,2011-06-17,"2011-10-03 00:00:00",2011-10-03
if you see in the first column after the 5 jump to 8, why? and if you keep applying the script it will jump and jump....
How to repeat:
This is a example data I have in a file called lin.txt
1,1,100,2011-09-21,2011-06-15,2011-10-03,2011-10-03
1,2,87,2011-09-12,2011-06-17,2011-10-03,2011-10-03
1,3,105,2011-09-16,2011-06-17,2011-10-03,2011-10-03
1,4,98,2011-09-18,2011-06-17,2011-10-03,2011-10-03
1,5,97,2011-09-23,2011-06-17,2011-10-03,2011-10-03
The table have 8 columns, where the first one is Autoincrement
So I execute this:
LOAD DATA INFILE 'lin.txt'
INTO TABLE tbl1
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(c1, c2, c3, c4, c5, c6, c7);
And after make a query get this:
1,1,1,100,2011-09-21,2011-06-15,"2011-10-03 00:00:00",2011-10-03
2,1,2,87,2011-09-12,2011-06-17,"2011-10-03 00:00:00",2011-10-03
3,1,3,105,2011-09-16,2011-06-17,"2011-10-03 00:00:00",2011-10-03
4,1,4,98,2011-09-18,2011-06-17,"2011-10-03 00:00:00",2011-10-03
5,1,5,97,2011-09-23,2011-06-17,"2011-10-03 00:00:00",2011-10-03
If you see the first column have the Id of the table which are okay (1,2,3,4,5)
No problem until now, but If I execute again the sentence:
LOAD DATA INFILE 'lin.txt'
INTO TABLE tbl1
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(c1, c2, c3, c4, c5, c6, c7);
and make a query over the table I get this
1,1,1,100,2011-09-21,2011-06-15,"2011-10-03 00:00:00",2011-10-03
2,1,2,87,2011-09-12,2011-06-17,"2011-10-03 00:00:00",2011-10-03
3,1,3,105,2011-09-16,2011-06-17,"2011-10-03 00:00:00",2011-10-03
4,1,4,98,2011-09-18,2011-06-17,"2011-10-03 00:00:00",2011-10-03
5,1,5,97,2011-09-23,2011-06-17,"2011-10-03 00:00:00",2011-10-03
8,1,1,100,2011-09-21,2011-06-15,"2011-10-03 00:00:00",2011-10-03
9,1,2,87,2011-09-12,2011-06-17,"2011-10-03 00:00:00",2011-10-03
10,1,3,105,2011-09-16,2011-06-17,"2011-10-03 00:00:00",2011-10-03
11,1,4,98,2011-09-18,2011-06-17,"2011-10-03 00:00:00",2011-10-03
12,1,5,97,2011-09-23,2011-06-17,"2011-10-03 00:00:00",2011-10-03
if you see in the first column after the 5 jump to 8, why? and if you keep applying the script it will jump and jump....