// SQL Server error reference

SQL Server error 220: Arithmetic overflow error for data type

A constant or result doesn't fit in a small integer type such as tinyint or smallint. The message shows the type and the value.

Error number
220
Severity
16
Category
Data conversion and truncation
Error message
Arithmetic overflow error for data type %ls, value = %ld.

What it means

Error 220 is raised when a value is too large (or negative, for tinyint) for an integer type, typically when assigning a constant or a computed integer: tinyint holds 0 to 255, smallint -32,768 to 32,767. It is closely related to 8115, which covers conversions such as decimal overflow.

Common causes

  • Storing a value over 255 in a tinyint, or a negative value in one.
  • An identity or counter column defined as tinyint or smallint running out of range.
  • Arithmetic on small integer columns whose result exceeds the type.

How to fix it

  1. Use a wider type for the column or variable.

    ALTER TABLE dbo.Settings ALTER COLUMN RetryCount smallint NOT NULL;
  2. Cast before doing arithmetic so the result has room.

    SELECT CAST(a AS int) * b FROM dbo.SmallNumbers;

Reproduce it safely

DECLARE @t tinyint = 256;  -- Msg 220: Arithmetic overflow error for data type tinyint, value = 256.

Related errors

More data conversion and truncation errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.