Hello,
One of our developers is trying to do a bulk insert into multiple tables that are dependent on each other and some of the inserts are erroring out with foreign key constraint issue.
INSERT statement conflicted with the FOREIGN KEY constraint "FK_dependintable_table". The conflict occurred in database "database", table "dbo.table", column 'id'.
When I ran the profiler trace I saw the inserts running in multiple batches and I think that is the reason why its happening.
Is there a way that we can prevent this? I meant without dropping and adding constraints? Like at the scope of transaction?
Thanks a lot
- Edited by SQLSPUser Tuesday, August 25, 2015 6:14 PM