Troubleshooting Guide: SQL Server Error 3606 – Arithmetic Overflow
Why This Error Happens
Error 3606 occurs when an arithmetic operation (such as multiplication, division, or implicit conversion) produces a value that exceeds the storage capacity of the target data type, such as TINYINT, SMALLINT, INT, or DECIMAL. This commonly happens with implicit data type conversions in calculations, undersized DECIMAL/NUMERIC precision and scale definitions, or when aggregate functions like SUM() operate on columns whose combined result exceeds the column’s native type limit. It can also surface after migrating databases to SQL Server 2025 if legacy stored procedures rely on older, looser overflow-handling behavior that newer compatibility levels no longer tolerate.
Step-by-Step Resolution Guide
Step 1: Identify the Offending Query or Procedure
- Check the SQL Server error log or Extended Events session for the exact statement that triggered Error 3606.
- Run the query manually in SQL Server Management Studio (SSMS) to reproduce the error and capture the execution plan.
- Use
SET ARITHABORT ON;before running the query to force immediate termination and pinpoint the failing expression.
Step 2: Review and Adjust Data Types
- Inspect the schema using
sp_help 'YourTableName';to check column data types involved in the calculation. - Increase precision/scale on
DECIMAL/NUMERICcolumns, e.g., changeDECIMAL(5,2)toDECIMAL(10,2)if values can exceed 999.99. - Explicitly cast intermediate calculation results to a larger type using
CAST(column AS BIGINT)orCAST(column AS DECIMAL(18,4))instead of relying on implicit conversions.
Step 3: Check Database Compatibility Level
- Open SSMS, right-click the database, go to Properties > Options, and verify the Compatibility Level field.
- If recently migrated, compare behavior against the previous SQL Server version’s compatibility level (e.g., 150 for SQL Server 2019 vs. 170 for SQL Server 2025).
- Run
ALTER DATABASE YourDB SET COMPATIBILITY_LEVEL = 170;only after testing, since compatibility level changes can affect other query behaviors.
Step 4: Patch and Update SQL Server
- Confirm you are running the latest Cumulative Update (CU) for SQL Server 2025 via
SELECT @@VERSION;. - Download and apply the latest CU from the Microsoft Update Catalog if your build number is outdated, as some overflow-handling bugs are patched in service releases.
- Restart the SQL Server service (
services.mscon Windows Server 2025/Windows 11) after installing updates.
Step 5: Modify Application-Level Calculations
- If the overflow originates from application code (e.g., .NET, Power BI, or SSIS packages) rather than raw T-SQL, review variable declarations passed into stored procedure parameters.
- Ensure parameter types in connection strings or ORM mappings (Entity Framework, ADO.NET) match the SQL Server column definitions exactly.
Alternative or Verification Steps
- Re-run the original query or application workflow that previously failed; confirm no Error 3606 appears in SSMS or the Windows Event Viewer (Applications and Services Logs > MSSQLSERVER).
- As an alternative, wrap the calculation in a
TRY_CAST()orTRY_CONVERT()function to gracefully returnNULLinstead of throwing a hard error, allowing you to isolate problematic rows with a follow-upWHERE result IS NULLquery.