Reputation:
I created table as follows:
CREATE TABLE IF NOT EXISTS `products` (
`ID` tinyint(3) NOT NULL AUTO_INCREMENT,
`SKU` varchar(30) NOT NULL,
`Title` varchar(100) NOT NULL,
`Description` text NOT NULL,
`Price` decimal(3,2) NOT NULL,
`Image1` varchar(100) NOT NULL,
`Image2` varchar(100) NOT NULL,
`Keywords` varchar(150) NOT NULL,
`Shop` tinyint(2) NOT NULL,
`lmlCat` tinyint(3) NOT NULL,
`VinylCat` tinyint(3) NOT NULL,
`FancyCat` tinyint(3) NOT NULL,
`Active` tinyint(1) NOT NULL,
`SizeDescription` varchar(50) NOT NULL,
`Size` varchar(250) NOT NULL,
PRIMARY KEY (`ID`)
);
When importing data from CSV, it imports 127 lines then I get this error:
#1062 - Duplicate entry '127' for key 'PRIMARY'
Upvotes: 1
Views: 294
Reputation: 2765
You made the ID
column a tinyint
which can only take values from -127 to 127, larger values are truncated. Make it a regular int
and things will work.
Upvotes: 6