How to fix Error 2767 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 2767 – Could Not Locate Statistics in System Catalogs

Why This Error Happens

Error 2767 occurs when a query or maintenance command (such as UPDATE STATISTICS or DBCC SHOW_STATISTICS) references a statistics object name that no longer exists in the sys.stats system catalog view. This typically happens because the statistics object was manually dropped, renamed, or was never created due to a failed index/statistics creation operation. It can also surface after a database restore or upgrade to SQL Server 2025 where metadata references became out of sync with the actual catalog entries.

Step-by-Step Resolution Guide

Step 1: Identify the Missing Statistics Reference

  • Open SQL Server Management Studio (SSMS) and connect to the affected instance.
  • Run the following query to check if the statistics object actually exists:
SELECT * FROM sys.stats WHERE name = 'StatisticsNameFromError';
  • Note the exact table and statistics name referenced in the error message for cross-checking.

Step 2: Validate System Catalog Consistency

  • Run DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to rule out catalog corruption.
  • Check SQL Server error logs located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for related corruption or metadata warnings.
  • If corruption is detected, restore from a known good backup rather than attempting a manual catalog repair.

Step 3: Recreate the Missing Statistics Object

  • Manually regenerate the statistics using:
CREATE STATISTICS stat_name ON dbo.TableName (ColumnName);
  • If the statistics were tied to an index that was dropped, recreate the index first, as SQL Server auto-generates associated statistics.
  • Avoid referencing auto-generated statistics names (prefixed with _WA_Sys_) directly in scripts, as these are system-managed and can change.

Step 4: Update Application or Job References

  • Review any SQL Agent Jobs, stored procedures, or maintenance plans under SQL Server Agent > Jobs in SSMS that explicitly call the old statistics name.
  • Update these references to use the newly created statistics name or switch to UPDATE STATISTICS TableName (without specifying a name) to target all statistics on the table safely.

Alternative or Verification Steps

  • Verify the fix by re-running the original failing command or job; confirm no Error 2767 appears in the SQL Server Error Log or Windows Event Viewer (Application log, Source: MSSQLSERVER).
  • If the issue persists across multiple objects, run sp_updatestats at the database level as a broader alternative to regenerate all outdated or missing statistics automatically.