| Previous | Next |
| DB_SEC_E_SAFEMODE_DENIED | DB_E_ALTERRESTRICTED |
DB_E_NOSTATISTIC
Meaning
Windows documents DB_E_NOSTATISTIC 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 case, a requested table statistic is absent, does not apply to the table or cannot provide the requested histogram.
Evidence to collect
When recording diagnostic 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: base-table DBID and statistic identity.
- Evidence 2: TABLE_STATISTICS rowset entry.
- Evidence 3: DBPROP_TABLESTATISTICS and histogram capability bits.
Relevant contract
OLE DB 2.6 table statistics expose cardinalities and optional histogram rowsets through schema metadata and IOpenRowset. A named statistic can be absent, inapplicable to a table or incapable of providing the requested histogram.
Investigation of this result should start with the data source, base-table DBID, statistic identity and reported DBPROP_TABLESTATISTICS capabilities.
Conditions that specifically lead to it
- Cause 1: the statistic name is not present in TABLE_STATISTICS.
- Cause 2: the statistic belongs to another table or column tuple.
- Cause 3: the provider exposes cardinality but not histogram support.
Diagnostic sequence
- Identify the exact failing stage: a requested table statistic is absent, does not apply to the table or cannot provide the requested histogram.
Corrective actions
- Action 1: enumerate available statistics before opening one.
- Action 2: fall back to cardinality-only estimates when appropriate.
- Action 3: 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 it.
Retry and recovery
Retry rule: retry after choosing an available applicable statistic or after the provider creates and exposes one.
Difference from nearby HRESULT values
DB_E_NOINDEX concerns an index object, while DB_E_NOSTATISTIC concerns optimizer statistics or histogram support.
Official Microsoft references
Looking for a different code? Search another status or error code.