| Previous | Next |
| DB_SEC_E_SAFEMODE_DENIED | DB_E_ALTERRESTRICTED |
DB_E_NOSTATISTIC
The specified statistic does not exist in the current data source or did not apply to the specified table or it does not support a histogram
Exact value and result class
DB_E_NOSTATISTIC has unsigned value 2147749532 (0x80040E9C) and signed 32-bit value -2147217764. AllStat describes it as “The specified statistic does not exist in the current data source or did not apply to the specified table or it does not support a histogram”. In this result, a requested table statistic is absent, does not apply to the table or cannot provide the requested histogram.
The high bit is set, so DB_E_NOSTATISTIC is a failure HRESULT. Its facility is 4 (FACILITY_ITF) and its low code is 3740 (0x0E9C). For DB_E_NOSTATISTIC, these fields identify an interface-defined result family; they do not identify the provider instance, method, object generation or partial effects.
Evidence to collect
A useful DB_E_NOSTATISTIC event records provider CLSID and version, process architecture, interface IID and method, object correlation ID, transaction state and the immediately preceding HRESULT. When recording DB_E_NOSTATISTIC data involving table and column names, cardinalities and data-distribution details, use types, lengths, hashes or redacted identifiers rather than secrets or complete business data.
- Evidence 1 for
DB_E_NOSTATISTIC: base-table DBID and statistic identity. - Evidence 2 for
DB_E_NOSTATISTIC: TABLE_STATISTICS rowset entry. - Evidence 3 for
DB_E_NOSTATISTIC: DBPROP_TABLESTATISTICS and histogram capability bits.
Contract boundary
For DB_E_NOSTATISTIC, OLE DB 2.6 table statistics expose cardinalities and optional histogram rowsets through schema metadata and IOpenRowset. For DB_E_NOSTATISTIC, a named statistic can be absent, inapplicable to a table or incapable of providing the requested histogram.
Investigation of DB_E_NOSTATISTIC should start with the data source, base-table DBID, statistic identity and reported DBPROP_TABLESTATISTICS capabilities. Capture DB_E_NOSTATISTIC before ADO, ATL, .NET or a database abstraction layer replaces the native HRESULT with a generic exception.
Conditions that specifically lead to this result
- Cause 1 for
DB_E_NOSTATISTIC: the statistic name is not present in TABLE_STATISTICS. - Cause 2 for
DB_E_NOSTATISTIC: the statistic belongs to another table or column tuple. - Cause 3 for
DB_E_NOSTATISTIC: the provider exposes cardinality but not histogram support.
Diagnostic sequence
- Capture raw
0x80040E9Cand symbolicDB_E_NOSTATISTICat the native call boundary. - Identify the exact failing stage for
DB_E_NOSTATISTIC: a requested table statistic is absent, does not apply to the table or cannot provide the requested histogram. - Retrieve all OLE DB error records for
DB_E_NOSTATISTICbefore another COM call replaces thread error information. - Compare the live object state and provider-granted capabilities with the input that produced
DB_E_NOSTATISTIC. - Reduce the
DB_E_NOSTATISTICoperation to the smallest case that preserves the same statistics contract. - Apply one evidence-backed correction for
DB_E_NOSTATISTICand verify that the result is not merely replaced by a neighboring HRESULT.
Corrective actions
- Action 1 for
DB_E_NOSTATISTIC: enumerate available statistics before opening one. - Action 2 for
DB_E_NOSTATISTIC: fall back to cardinality-only estimates when appropriate. - Action 3 for
DB_E_NOSTATISTIC: treat missing statistics as metadata absence rather than corrupt table data.
Practical scenario
A query planner asks for a histogram from a provider that reports cardinalities only; using the available estimate avoids DB_E_NOSTATISTIC. Keeping DB_E_NOSTATISTIC with the method and object state makes this scenario diagnosable instead of reducing it to “database error”.
Developer and operations guidance
Code handling DB_E_NOSTATISTIC should release COM objects in ownership order, retain per-row, per-column or per-property statuses, and log granted capabilities rather than only requested options. While handling DB_E_NOSTATISTIC, opaque values such as HACCESSOR, HROW, HCHAPTER, DBID components and provider handles must remain scoped to the object that issued them.
Operational dashboards for DB_E_NOSTATISTIC should group by provider version, interface, method and normalized failure stage. A DB_E_NOSTATISTIC event must not expose passwords, tokens, full connection strings, unrestricted command text or raw row contents.
Retry and recovery
Retry rule for DB_E_NOSTATISTIC: retry after choosing an available applicable statistic or after the provider creates and exposes one. A DB_E_NOSTATISTIC retry is safe only when the relevant input, object generation, capability or external state has changed. Before replaying a modifying call that returned DB_E_NOSTATISTIC, determine whether rows, schema objects or URL resources were partially created or changed.
Do not turn DB_E_NOSTATISTIC into an unbounded retry loop. Preserve cancellation for DB_E_NOSTATISTIC and use a fresh provider object when the failed call may have left local state ambiguous.
Difference from nearby HRESULT values
DB_E_NOINDEX concerns an index object, while DB_E_NOSTATISTIC concerns optimizer statistics or histogram support. Telemetry and remediation for DB_E_NOSTATISTIC should keep these outcomes distinct.
Official Microsoft references
- Microsoft: OLE DB table statistics and histogram rowsets — official documentation relevant to
DB_E_NOSTATISTIC. - Microsoft: DBPROP_TABLESTATISTICS — official documentation relevant to
DB_E_NOSTATISTIC. - Microsoft: OLE DB rowsets — official documentation relevant to
DB_E_NOSTATISTIC.
Looking for a different code? Search another status or error code.