Summary:

Deleting a person or company results in an SQL error: "An unexpected event has occured: Exception: SQL Error"

However the record is actually deleted.

Symptoms:

SQL Error : Incorrect syntax near the keyword 'WHERE' (DELETE FROM WHERE Visi_CompanyId = 27579)

SQL Error : Incorrect syntax near the keyword 'WHERE' (DELETE FROM WHERE Visi_PersonId = 34969)

Resolution:

The issue was that the Visitor and VisitorProfiles tables had been soft deleted on the Custom_Tables table of the database. Once these tables were undeleted from the database using the following query and the metadata was refreshed the issue was resolved.

update custom_tables set Bord_Deleted = NULL where Bord_Name IN ('Visitor','VisitorProfile')