cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Summary

When attempting to manually import inventory, you may receive the following error: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_MCCP_Media"

Symptoms

When attempting to import an inventory (*.ndi) file into Inventory Manager 2015, you may receive the following error:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_MCCP_Media" . The conflict occurred in database "IM, table "dbo.Media", column "MediaID". The statement has been terminated.
Unexpected exception in importer

Cause

This is caused by having 0 (zero) rows in the dbo.Media table in the Inventory Manager database. When the import process attempts to insert rows into the dbo.MediaContainsPackagePath it attempts to cross reference the MediaID column with the dbo.Media table and because this table is empty, the import fails.

Resolution

The resolution to this is in two parts.

Firstly, we have to insert a record into the dbo.Media table. To do this, please run the following on the IM database:


SET identity_insert Media ON
INSERT INTO Media (MediaID, Title, MediaTypeID, Location)
VALUES (1, '', 1, '')
SET identity_insert Media OFF


Secondly, we need to remove a step in the 'Daily IM Data Maintenance' SQL job. This job calls a Stored Procedure, and we need to remove a step which deletes unused data from the Media table:

EXEC MediaDeleteUnused

Please run the attached DBMaintenance.sql file on the IM database. This will drop and re-create the Stored Procedure with this line removed.

Workaround

Please see above for resolution.
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎May 04, 2018 02:08 AM
Updated by: