ERROR 1062 (23000): Duplicate entry '2147483647' for key 1
Hi,
I have created a table:
CREATE TABLE `sow` (
`sow_no` int(11) NOT NULL default '0',
`item_code` varchar(20) NOT NULL default '',
`line_code` tinyint(4) NOT NULL default '0',
`lot_no` varchar(10) NOT NULL default '',
`qty` smallint(6) NOT NULL default '0',
`unit_no` smallint(6) NOT NULL default '0',
`start` date NOT NULL default '0000-00-00',
`end` date NOT NULL default '0000-00-00',
`note` varchar(80) NOT NULL default '',
PRIMARY KEY (`sow_no`),
KEY `item_code` (`item_code`,`lot_no`,`line_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
It currently contains the following rows:
+------------+-----------+-----------+------------+-----+---------+------------+------------+------+
| sow_no | item_code | line_code | lot_no | qty | unit_no | start | end | note |
+------------+-----------+-----------+------------+-----+---------+------------+------------+------+
| 1 | P0001 | 1 | 1051012345 | 250 | 1 | 2005-10-18 | 2005-10-19 | |
| 1051100001 | P0001 | 1 | 1051100001 | 100 | 0 | 2005-11-05 | 2005-11-06 | |
| 1051100002 | P0001 | 1 | 1051100002 | 200 | 0 | 2005-11-06 | 2005-11-07 | |
| 1051100004 | P0001 | 1 | 1051100004 | 50 | 1 | 2005-11-10 | 2005-11-11 | |
| 1051100005 | P0001 | 1 | 1051100005 | 50 | 1 | 2005-11-10 | 2005-11-11 | |
| 2147483647 | B10224 | 1 | 8051100003 | 150 | 0 | 2005-11-08 | 2005-11-09 | |
+------------+-----------+-----------+------------+-----+---------+------------+------------+------+
I try to insert a new row:
INSERT INTO sow VALUES ('7051100001', 'B10225', '1', '7051100001', '200', '1', '2005-11-11', '2005-11-12', '');
and get the error in the subject of this post:
ERROR 1062 (23000): Duplicate entry '2147483647' for key 1
the primary key (sow_no) value I want to insert ('7051100001') is not, obviously, a
duplicate of the value returned in the error ('2147483647'). The primary key is the
only key in this table that has a unique constraint...
earlier inserts went OK, as evidenced by the data allready in the table.
What might be the problem?
Thanks for any help