Problem
Whilst performing a migration from one version of RMS to another, the database migration process could fail due to experiencing a FOREIGN KEY constraint FK_SoftwareValue_SoftwareOccurence error.
Cause
This issue will occur if the SoftwareValue table contains records that do not have an associated record within the SoftwareOccurrence table. This can easily be validated by running the following query against the database:
SELECT * FROM SoftwareValue
WHERE SoftwareOccurrenceID NOT IN (SELECT SoftwareOccurrenceID FROM SoftwareOccurrence)
Solution
Run the following query to rectify this issue:
DELETE From SoftwareValue
WHERE SoftwareOccurrenceID NOT IN (SELECT SoftwareOccurrenceID FROM SoftwareOccurrence)
Comments