0

I am working on a SSIS(ETL proces) where I have a datavault. The datavault contains HUBS LINKS and SATS. The whole proces is almost working except a few SATS. One of them is the CONSIGNMENT table. It says this: "The INSERT statement conflicted with the FOREIGN KEY constraint "FK_SAT_CONS_REFERENCE_HUB_CONS". The conflict occurred in database "anbc_datavault", table "dbo.HUB_CONSIGNMENT", column 'HUB_CONSIGNMENT_ID'.".

I checked it in SQL but everything is working. The HUB_CONSIGNMENT_ID, which is in the HUB_CONSIGNMENT table(PK there), has a reference to the SATS table. enter image description here

I don't know how I can fix this problem.

Anyone who can help? Thanks!

I deleted the whole database and created it again with the sql script. I checked also if there was something wrong but that wasn't the case. I am a student that learns the ETL process.

  • 1
    The problem is that whatever you're trying to insert is missing some key in another table – siggemannen May 16 '23 at 12:13
  • @siggemannen I checked it. the table HUB has one PK namely HUB_CONSIGNMENT_ID. The tabel SAT_CONSIGNMENT has 1 PK which is HUB_CONSIGNMENT_ID & LDTS. It has also one FK which is the reference from the hub consignment table to the the sats table – Banana Power May 16 '23 at 12:23
  • 1
    i don't think you follow what i mean. if you insert into sometable (col1,col2,col3) values (1,2,3); and there's FK for col1 against sometable2, then value = 1 must exist in sometable2 before your insert. Read about what Foreign key does – siggemannen May 16 '23 at 12:25
  • you need to check the actual data you're trying to insert and see so the "base" data already exist – siggemannen May 16 '23 at 12:26

0 Answers0