I am trying to import data from an Excel document to MySQL Management Studio, and when attempting to do so, the data fails to import on a specific intersection table, which has the following data:
The table I am inserting to is called TYearLeagues, and the error I receive states that:
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The INSERT statement conflicted with the FOREIGN KEY constraint "TYearLeagues_TYears_FK". The conflict occurred in database "dbSQL2", table "dbo.TYears", column "intYearID"."
The intersection table is set up like so:
CREATE TABLE TYearLeagues
(
intYearID INTEGER NOT NULL
,intLeagueID INTEGER NOT NULL
,CONSTRAINT TYearLeagues_PK PRIMARY KEY (intYearID, intLeagueID)
)
And the foreign key constraint like so:
ALTER TABLE TYearLeagues ADD CONSTRAINT TYearLeagues_TYears_FK
FOREIGN KEY ( intYearID ) REFERENCES TYears( intYearID )
Whereas I could understand an issue in a normal table, as TYearLeagues is an intersection table, and there are no duplicate records, I do not understand the issue.
Aucun commentaire:
Enregistrer un commentaire