Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Duplicate key -error when exporting to BYOD

(1) ShareShare
ReportReport
Posted on by 187
I have recently started to get the following error with recurring BYOD export: 
""Violation of PRIMARY KEY constraint 'PK_XXXStaging'. Cannot insert duplicate key in object 'dbo.XXXStaging'. The duplicate key value is (Export across company: XXX - 17.12.2024 10.24.47.-09C1857EBD804C81884EF1BA788EC8DA, 1.0000000000000000, 150-000002, initial).". Failed to insert record into staging table. The keys of the record are DEFINITIONGROUP, EXECUTIONID, XXX, PARTITION, XXX. Duplicate records must be removed from the file prior to import."
 
The entity being exported is a custom and it's been working fine so far. It stopped working the following day when Quality update of 10.0.41 was installed so, I assume something was changed there (but may also be coincidence). 
I have truncated the entity's staging table and republished entity to BYOD, but nothing works. It complains about duplicate event when I choose to export only one record! 
I have checked that the entity works fine (with odata query) - there are no duplicates. I also exported some rows to CSV files and they work fine. Also rows gets copied to staging table just fine, but the problem is the target SQL BYOD Staging-table - the final step of the process.
 
Have anyone solved this kind of situation earlier? 
Categories:
  • Martin Dráb Profile Picture
    Martin Dráb 230,392 Most Valuable Professional on at
    Duplicate key -error when exporting to BYOD
    One of my clients reported similar errors starting in 10.0.40, but in all cases, there really were duplicates, although not always obvious. It seems that the problem used to be silently ignored (the export ended with Partially succeeded status and no one payed attention to it), but it was made more disruptive in 10.0.40. 
     
    It's not clear whether your problem is the same, but it could be.
     
    You mentioned you got the problem even when exporting a single record. Please run a SQL query against the entity view and check that there are duplications any unique index of XXXStaging (usually just StagingIdx, but you might have created more). Maybe you'll get a different result than in your previous tests.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,361 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,392 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans