Skip to content
Microsoft SQL Server

SQL Server Error 8115

Arithmetic overflow error converting expression to data type

Applies to: All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
Last technically reviewed 23 October 2026 on SQL Server 2025 (17.0.1145.4)
The full message
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.
Other forms of this message
DECIMAL or NUMERIC precision too small
Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting numeric to data type numeric.
IDENTITY column out of values (followed by a second line)
Msg 8115, Level 16, State 1, Line 1
Arithmetic overflow error converting IDENTITY to data type int.
Arithmetic overflow occurred.
bigint arithmetic
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type bigint.
Error number
8115
Severity
16 (user-correctable error)
State
2
Product
Microsoft SQL Server Database Engine
Versions
All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
Last reviewed
23 October 2026

What it means

Error 8115 means a number came out larger than the data type that has to hold it, so SQL Server stopped the statement instead of storing a wrong value.

The end of the message names the type that overflowed: int tops out at 2,147,483,647, bigint at about 9.2 quintillion, and DECIMAL(p,s) at p - s digits before the decimal point. The part before it says what was being converted: expression for arithmetic and casts, numeric for a decimal that does not fit a smaller precision, IDENTITY for an identity column that has run out of values.

Arithmetic on int values is done in int, so SUM() over an int column, or the product of two int literals, can overflow even when every input fits. Converting into the smaller integer types behaves differently: on SQL Server 2025, an out-of-range value for tinyint or smallint raises error 220, Arithmetic overflow error for data type tinyint, value = 300., which shows the value that did not fit.

Common causes

  • SUM() over an int column whose total passes 2,147,483,647: the result type of SUM over int is int.
  • Multiplying or adding int values (columns or literals) whose result does not fit in int.
  • CAST or CONVERT of a large value to int, or of a decimal to a DECIMAL with too few digits before the point.
  • An int IDENTITY column that has used its last value.
  • Assigning a computed result to a variable or column declared with a type that is too small.

Diagnose it

Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.

Check the largest values and the total in a wide type

Computing the total as bigint shows how far past the int limit it goes without raising the error.

SELECT MAX(Amount) AS largest,
       SUM(CAST(Amount AS bigint)) AS total_as_bigint,
       CASE WHEN SUM(CAST(Amount AS bigint)) > 2147483647 THEN 'overflows int' ELSE 'fits in int' END AS verdict
FROM dbo.Sales;
What to look for

A total above 2,147,483,647 confirms that the aggregate, not a single row, overflows.

See how much room each IDENTITY column has left

SELECT OBJECT_NAME(ic.object_id) AS table_name, ic.name AS column_name, TYPE_NAME(ic.system_type_id) AS data_type,
       CAST(ic.last_value AS bigint) AS last_value,
       CAST(ic.increment_value AS bigint) AS increment
FROM sys.identity_columns AS ic
WHERE OBJECTPROPERTY(ic.object_id, 'IsUserTable') = 1
ORDER BY CAST(ic.last_value AS bigint) DESC;
What to look for

An int identity whose last_value is close to 2,147,483,647 will soon raise the IDENTITY form of 8115. A NULL last_value means no row has been inserted yet.

Read the precision and scale of the target column

SELECT c.name AS column_name, TYPE_NAME(c.user_type_id) AS data_type, c.precision, c.scale
FROM sys.columns AS c
WHERE c.object_id = OBJECT_ID(N'dbo.Orders');
What to look for

For DECIMAL(p,s), the largest value is p minus s digits before the point; anything bigger raises the numeric form of 8115.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Accumulate in a wider type

Read-only

Cast inside the aggregate or the arithmetic so the calculation runs in bigint or a large DECIMAL. Casting the result afterwards is too late.

SELECT SUM(CAST(Amount AS bigint)) AS Total
FROM dbo.Sales;

SELECT CAST(100000 AS bigint) * 100000 AS Product;

Give DECIMAL enough precision

Read-only

Choose a precision that leaves room for the largest value, for example DECIMAL(19,2) for money totals.

SELECT CAST(123456.789 AS DECIMAL(9,2)) AS Result;

SELECT SUM(CAST(Amount AS DECIMAL(19,2))) AS Total
FROM dbo.Sales;

Widen the column that keeps overflowing

Changes schema

If stored values outgrow int, change the column to bigint (or a wider DECIMAL). For an exhausted int IDENTITY, bigint is the long-term fix.

Caution:

Altering a column type is a size-of-data operation on large tables and fails while a primary key, index or foreign key depends on the column; those must be dropped and recreated. Plan it as a migration and test on a copy first.

ALTER TABLE dbo.Sales ALTER COLUMN Amount BIGINT;

Reseed an exhausted IDENTITY into an unused range

Changes schema

A short-term option when changing the type is not possible yet: reseed to a range that has never been used, such as the negative values.

Caution:

Reseeding into a range that already has rows causes duplicate key errors (2627) or duplicate values. Check with sys.identity_columns and MIN(id) first, and make sure the application accepts negative ids.

DBCC CHECKIDENT ('dbo.Orders', RESEED, -2147483648);

Examples

A SUM over a large int column overflows int

CREATE TABLE dbo.Sales (
    Amount INT
);
INSERT INTO dbo.Sales (Amount) VALUES (2000000000), (2000000000);

-- Each row fits in int, but SUM over int returns int and 4,000,000,000 does not
SELECT SUM(Amount) AS Total FROM dbo.Sales;
Result
Msg 8115, Level 16, State 2, Line 7
Arithmetic overflow error converting expression to data type int.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

A value too big for a DECIMAL precision

-- DECIMAL(5,2) holds at most 999.99
SELECT CAST(123456.789 AS DECIMAL(5,2)) AS Result;
Result
Msg 8115, Level 16, State 8, Line 2
Arithmetic overflow error converting numeric to data type numeric.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

A multiplication that exceeds int range

-- Both operands are int, so the product is computed as int and overflows
SELECT 100000 * 100000 AS Product;
Result
Msg 8115, Level 16, State 2, Line 2
Arithmetic overflow error converting expression to data type int.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

How to prevent it

Size keys and counters for growth: use bigint for identity columns on tables that can pass two billion rows over their lifetime, and monitor identity headroom with the query above. Give DECIMAL columns the precision of the largest value the business can produce, not the largest seen so far.

Make wide aggregation a habit in reports: SUM(CAST(x AS bigint)) costs nothing extra and removes the int ceiling. For conversions that fail because the text is not a number at all, see error 8114.

Common questions

Why does SUM overflow when every row fits in int?

SUM over an int column returns int, so the running total is held in int. Two rows of 2,000,000,000 already exceed the int maximum of 2,147,483,647. Cast the column to bigint inside the SUM.

Why do I get error 220 instead of 8115?

On SQL Server 2025, converting an out-of-range value to tinyint or smallint raises error 220, which shows the value (for example value = 300). Overflows into int, bigint and DECIMAL raise 8115.

What does Arithmetic overflow error converting IDENTITY to data type int mean?

The int identity column has reached 2,147,483,647 and cannot generate the next value. Change the column to bigint, or as a stopgap reseed it into an unused range such as negative numbers.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 23 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.

Still stuck on a SQL Server error?

Browse the full SQL Server error library, or get hands-on help from an experienced SQL professional.