I ran into this problem while working on a project, but here is a simple example that replicates an “error” ...
First create a table with the last column being a kind of varchar:
Create table testtable(
ProductName varchar(100),
Color varchar(50),
CategoryID varchar(5)
);
Create a tab delimited text file with data:
Shirt Red 1111
Pants Blue 2222
Shoes Green 3333
Loading data into a table:
load data infile 'testtable.txt' into table testtable;
I do not receive any errors or warnings or anything else. But, when I try to request data, it looks rather strange:
select * from testtable;
ProductName Color CategoryID
Red 1111
Blue 2222
Shoes Green 3333
Requests that will connect to ProductName will not work.
Then create a table with int as the last column:
Create table fixedtable(
ProductName varchar(100),
Color varchar(50),
CategoryID varchar(5),
Inventory int
);
Create a tab delimited text file with data:
Shirt Red 1111 10
Pants Blue 2222 15
Shoes Green 3333 20
Loading data into a table:
load data infile 'fixedtable.txt' into table fixedtable;
And now the table looks fine:
select * from fixedtable;
ProductName Color CategoryID Inventory
Shirt Red 1111 10
Pants Blue 2222 15
Shoes Green 3333 20
I have not tried repeating this using "Insert Into" or something like that; For this project, I specifically must use the "load data infile" statement.
, ... , - ? Windows 7.
- ? , ?