简体   繁体   中英

Migrating a self referencing table using Azure Data Factory

I am trying to migrate a table which has 2 colums.

Id - Primarky key
Parent ID - Foreign key populated by the value above (Id). 

(So basically the FK is in the same table) When I migrate this, I get the following error. "The UPDATE statement conflicted with the FOREIGN KEY SAME TABLE constraint" Please let me know how to deal with this. Thanks in advance

Disable the foreign key constraint first. Then migrate your data. And afterwards you can enable the constraint again.

ALTER TABLE Purchasing.PurchaseOrderHeader  
NOCHECK CONSTRAINT FK_PurchaseOrderHeader_Employee_EmployeeID; 


ALTER TABLE Purchasing.PurchaseOrderHeader  
CHECK CONSTRAINT FK_PurchaseOrderHeader_Employee_EmployeeID;  

Disable foreign key constraints with INSERT and UPDATE statements

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM