Importing an XML file, java.sql.BatchUpdateException: Duplicate entry error for key 'PRIMARY' is reported.


Description

After importing XML to cmdb_ci_service the following error is received:

java.sql.BatchUpdateException: Duplicate entry 'be0b994a4fed2300cc77d3ef0310c7d4' for key 'PRIMARY'
java.sql.BatchUpdateException: Duplicate entry '92738c75db20fbc07d8b134d0b9619b8' for key 'PRIMARY'

Cause

The objects imported contain the same sys_id.

Resolution


XML import works based on sys_id, it is needed to be sure that the imported data sys_id values don't exist on the target table.

Additional Information

Additional information about this topic can be found on ServiceNow documentation:

Using XML import sets