| Previous | Next |
| DB_E_MULTIPLESTATEMENTS | DB_E_BADTYPENAME |
DB_E_INTEGRITYVIOLATION
Meaning
Windows documents DB_E_INTEGRITYVIOLATION as “Value violated the integrity constraints for a column or table”. Here, an inserted or updated value violates an integrity constraint on a column or table.
Specific conditions that produce the result
- Cause 1: a unique or primary-key value duplicates an existing row.
- Cause 2: a foreign-key value has no referenced parent.
- Cause 3: a check constraint or required relationship rejects the new state.
Relevant OLE DB contract
This result must be interpreted against this contract: OLE DB schema contracts combine DBIDs, provider type metadata, column attributes, constraints and locale rules; current provider metadata is authoritative; cached ordinals or type assumptions can become invalid after a schema or command change.
Start with the table, column, parameter or schema object named by the failing definition or data operation when investigating this result.
Evidence to collect before changing the system
- Evidence 1: the table, column and constraint identifiers from provider diagnostics.
- Evidence 2: the key or relationship values in redacted form.
- Evidence 3: transaction state and competing writes that may have changed the constraint outcome.
Corrective actions
- Action 1: correct the data or operation ordering to satisfy the constraint.
- Action 2: handle duplicate and referential failures as distinct business outcomes.
- Action 3: retry concurrency-sensitive writes only after rereading the governing rows.
Practical incident
Two workers insert the same natural key after both pass an application-side existence check; handling the unique constraint result prevents blind retries of it.
Retry and recovery policy
Retry rule: retry only after the constrained values or referenced data change.
Difference from related HRESULT values
DB_E_SCHEMAVIOLATION is a broader schema mismatch, while DB_E_INTEGRITYVIOLATION specifically identifies a column or table integrity constraint.
Official Microsoft references
Looking for a different code? Search another status or error code.