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

Troubleshooting Guide: SQL Server Error 511 – Maximum Row Size Exceeded

Why This Error Happens

This error occurs when an INSERT or UPDATE operation attempts to create or modify a row whose total size exceeds SQL Server’s 8,060-byte page row limit. This typically happens with tables containing multiple VARCHAR, NVARCHAR, or VARBINARY columns that individually fit within limits but collectively exceed the maximum when populated with large data. It can also occur during index operations where the combined key size surpasses the allowable threshold, or when schema changes (like adding columns) push existing wide tables past the boundary.

Step-by-Step Resolution Guide

Step 1: Identify the Offending Table and Row Size

  • Run sp_help 'YourTableName' in SSMS to review column definitions and data types.
  • Use DBCC CHECKTABLE ('YourTableName') WITH ESTIMATEONLY or query sys.dm_db_index_physical_stats to estimate row size.
  • Calculate cumulative byte size of all fixed and variable-length columns to confirm which columns push the row over 8,060 bytes.

Step 2: Redesign the Table Schema

  • Convert large VARCHAR(n) or NVARCHAR(n) columns to VARCHAR(MAX) or NVARCHAR(MAX) where appropriate, since MAX types store overflow data off-row.
  • Move rarely-accessed or large columns into a separate related table (vertical partitioning) linked by a foreign key.
  • Example schema change:
  ALTER TABLE YourTableName ALTER COLUMN LargeColumn VARCHAR(MAX);

Step 3: Enable Row-Overflow Storage Options

  • Ensure the table uses the ROW compression or PAGE compression setting, which can help manage variable-length column storage.
  • Verify the large value types out of row table option is correctly configured:
  EXEC sp_tableoption 'YourTableName', 'large value types out of row', '1';
  • This forces SQL Server to store MAX data types off the main data page, reducing in-row size.

Step 4: Adjust Indexes Contributing to Row Size

  • Review any composite indexes with wide key columns, since large index keys can also trigger this error on INSERT/UPDATE.
  • Drop and recreate indexes with fewer or narrower key columns using INCLUDE columns instead of composite keys where possible:
  CREATE NONCLUSTERED INDEX IX_Example ON YourTableName (KeyColumn) INCLUDE (LargeColumn);

Step 5: Apply Latest SQL Server 2025 Cumulative Update

  • Navigate to Microsoft Update Catalog or use SQL Server Installation Center on Windows Server 2025 to check for the latest Cumulative Update (CU).
  • Some row-size calculation edge cases are patched in updates; confirm via SELECT @@VERSION; after installation.

Alternative or Verification Steps

  • After applying schema changes, re-run the original INSERT/UPDATE statement that triggered Error 511 to confirm it completes successfully.
  • If the error persists, use DBCC CHECKTABLE with TABLERESULTS to identify any remaining row-size violations, or consider archiving historical data to reduce row width in high-volume tables.