| Previous | Next |
| DB_E_BADCOMMANDID | DB_E_BADCONSTRAINTFORM |
DB_E_BADCONSTRAINTTYPE
Meaning
Windows documents DB_E_BADCONSTRAINTTYPE as “ConstraintType is invalid or not supported by the provider”. In this case, a constraint descriptor names a constraint type that is invalid or unsupported by the provider.
Relevant contract
OLE DB DDL interfaces identify indexes, commands and constraints with provider-scoped DBIDs. Constraint descriptors also carry type, column arrays, match behavior, deferrability and update/delete rules that must agree as one structure.
Investigation of this result should start with the session performing DDL, target table metadata and the exact DBID or DBCONSTRAINTDESC supplied.
Diagnostic sequence
- Identify the exact failing stage: a constraint descriptor names a constraint type that is invalid or unsupported by the provider.
Conditions that specifically lead to it
- Cause 1: the enumeration value is outside DBCONSTRAINTTYPE.
- Cause 2: the provider does not implement that constraint category.
- Cause 3: a descriptor was initialized for another OLE DB version.
Evidence to collect
A useful diagnostic event records provider CLSID and version, process architecture, interface IID and method, object correlation ID, transaction state and the immediately preceding HRESULT. When recording diagnostic data involving catalog names, schema names, object identifiers and deployment definitions, use types, lengths, hashes or redacted identifiers rather than secrets or complete business data.
- Evidence 1: ConstraintType value.
- Evidence 2: provider constraint capabilities.
- Evidence 3: the complete DBCONSTRAINTDESC without sensitive names.
Corrective actions
- Action 1: choose a documented supported constraint type.
- Action 2: feature-detect provider DDL support.
- Action 3: fall back to provider command text only when equivalent and controlled.
Retry and recovery
Retry rule: retry after selecting a valid constraint type supported by the provider.
Difference from nearby HRESULT values
DB_E_BADCONSTRAINTFORM means a recognized type has inconsistent fields, while DB_E_BADCONSTRAINTTYPE rejects the type itself.
Practical scenario
A schema tool requests a CHECK constraint from a provider that supports only keys; capability filtering prevents it. Keeping it with the method and object state makes this scenario diagnosable instead of reducing it to “database error”.
Official Microsoft references
Looking for a different code? Search another status or error code.