mysql - Foreign Key Constraints on an Intersection Table -
i trying import data excel document mysql management studio, , when attempting so, data fails import on specific intersection table, has following data:
the table inserting called tyearleagues, , error receive states that:
an ole db record available. source: "microsoft sql server native client 11.0" hresult: 0x80004005 description: "the insert statement conflicted foreign key constraint "tyearleagues_tyears_fk". conflict occurred in database "dbsql2", table "dbo.tyears", column "intyearid"."
the intersection table set so:
create table tyearleagues ( intyearid integer not null ,intleagueid integer not null ,constraint tyearleagues_pk primary key (intyearid, intleagueid) )
and foreign key constraint so:
alter table tyearleagues add constraint tyearleagues_tyears_fk foreign key ( intyearid ) references tyears( intyearid )
whereas understand issue in normal table, tyearleagues intersection table, , there no duplicate records, not understand issue.
edit: added tyears table, better clarity. @ least, intyearids 1-3 accounted for.
i don't think it's complaining duplicates, means inserting row refers year not exist in tyears
Comments
Post a Comment