Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Failed to insert record into staging table. Duplicate records must be removed from the file

(1) ShareShare
ReportReport
Posted on by 1,485
Hi,

When i import 1 record at a time, i get no errors. However, when i import more than one, i get this error below.
So if i have new 4 records to import, if i import them 1 by 1 it works, if i import the 4 records together in the excel, i get this error

I'm using entity SalesOrderLineV2Entity, and there is a customization on it where i added an outer join datasource with salesLine.
Failed to insert record into staging table. The keys of the record are DEFINITIONGROUP, EXECUTIONID, INVENTORYLOTID, PARTITION. Duplicate records must be removed from the file prior to import.
<?xml version="1.0"?><Errors><Error><ErrorCode>-1071636471</ErrorCode><SubComponent>OLE DB Destination [526]</SubComponent><Description>SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "The statement has been terminated.".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Violation of PRIMARY KEY constraint 'I_18374STAGINGIDX'. Cannot insert duplicate key in object 'dbo.SALESORDERLINEV2STAGING'. The duplicate key value is (5637144576, import sales line v2, import sales line v2-2025-01-13T00:35:23-B8EA12CAB8EC4098BED3327A437E9854, ).".
</Description></Error><Error><ErrorCode>-1071607767</ErrorCode><SubComponent>OLE DB Destination [526]</SubComponent><Description>SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC020907B occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
</Description></Error><Error><ErrorCode>-1073450974</ErrorCode><SubComponent>SSIS.Pipeline</SubComponent><Description>SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "OLE DB Destination" (526) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (539). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
</Description></Error></Errors>
 
Categories:
  • S Gopi Krishna Profile Picture
    397 on at
    Failed to insert record into staging table. Duplicate records must be removed from the file
    Try removing the inventory lot id column from the excel sheet and import.
  • .. Profile Picture
    1,485 on at
    Failed to insert record into staging table. Duplicate records must be removed from the file
    Hi Alireza,

    I mentioned that i made the invenotryLot values as empty in the excel in order to consider it as an insert.
     
    if i import more than one record it fails, if i import only one it works.

    I tried in another environment where the customization is not there but same error
  • Suggested answer
    Alireza Eshaghzadeh Profile Picture
    13,585 Super User 2025 Season 1 on at
    Failed to insert record into staging table. Duplicate records must be removed from the file
    Hi,
    Based on the error message, it appears there is a duplicate in the source data for the entity's key fields. Please verify that the values in the field "InventoryLotId" are unique. Duplicates in this field will cause the issue, so ensuring uniqueness should resolve it. 
  • .. Profile Picture
    1,485 on at
    Failed to insert record into staging table. Duplicate records must be removed from the file
    Hi Komi,

    I exported a sales order with 4 lines, then i deleted the order lines from SQL
     
    then i opened the exported file, and deleted the values under InventoryLOTID -- i clicked save, closed the file then imported it again. still same error
  • Suggested answer
    Komi Siabi Profile Picture
    12,772 Most Valuable Professional on at
    Failed to insert record into staging table. Duplicate records must be removed from the file
    The excel sheet definitely has some blank rows being imported into Dynamics. 
     
    Delete all rows after the 4 records, and re-import. Also ensure there are not duplicate INVENTORYLOTID on the file.

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

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,850 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,719 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans