Skip to main content

Error when deleting a course: A constraint violation has prevented the data from being deleted

Error message when trying to delete a course.

H
Written by Harry Ledger
Updated over 3 weeks ago

This error indicates that there is a training history record linked to the course that is failing to delete.
​
To find who has the linked record, you will need to follow these steps.

  1. In the Admin Tool, click Import/Export Data.

  2. Click Create an export definition.

  3. Click Select the data to export.

  4. Change the database to SelectHR.

  5. Log in.

  6. Copy the below SQL:

Select Course.Events.[Course Start Date], Course.Events.[Course End Date], Course.Events.[Course Title], Course.Events.[Course Number], Course.Events.[Event Number], Training.History.*, Person.Snapshot.[First Name], Person.Snapshot.Surname From Course.Events Inner Join Training.History On Course.Events.[Event Number] = Training.History.[Event Number] Inner Join Person.Snapshot On Training.History.[Person Number] = Person.Snapshot.[Person Number] Where Course.Events.[Course Title] = 'ENTER COURSE NAME'

Once you have identified the person with the training record, go to their training history to delete the record.
​
If you require further assistance, please raise a new case online and reference the title of this article confirming the following details: Course Name and the date of the course.

Did this answer your question?