Re: Duplicate entry '0' for key 'PRIMARY'
Date: Sat, 15 Apr 2017 15:32:48 +0100
Message-ID: <octaug$vbv$1_at_news.albasani.net>
On 15/04/17 15:05, Thomas 'PointedEars' Lahn wrote:
> But IN THIS CASE there should not be a foreign key referring to that
> table in the first place. If it were, data integrity would already be
> compromised.
In nutshell, this is the issue.
If there are duplicate primary keys in the data to be imported, the problem exists already and must be corrected in any case.
[Quoted] One very faint possibility is that data is being imported into a table that is not clean, even if its data has been deleted it may still have an 'autofincrement' value implicit in it.
delete * from my_table
[Quoted] should always be followed by an
alter table my_table autoincrement=1;
[Quoted] etc. before importing data into it, if its been used before.
However I suspect this is irrelevant in this instance.
-- "Socialist governments traditionally do make a financial mess. They always run out of other people's money. It's quite a characteristic of them" Margaret ThatcherReceived on Sat Apr 15 2017 - 16:32:48 CEST