// SQL Server error reference

SQL Server error 248: Conversion overflowed an int column

A string holding a number larger than the int range (about 2.1 billion) was converted to int. Use bigint or decimal for big numbers.

Error number
248
Severity
16
Category
Data conversion and truncation
Error message
The conversion of the %ls value '%.*ls' overflowed an int column.

What it means

When converting a character value to int, SQL Server checks the range -2,147,483,648 to 2,147,483,647. A string like '3000000000', or a long numeric code such as a phone number stored as text, overflows and raises 248.

Common causes

  • Phone numbers, account numbers or other long codes converted to int.
  • Implicit conversion of a large numeric string to int because it's compared with an int column or value.

How to fix it

  1. Convert to bigint or decimal instead.

    SELECT CAST('3000000000' AS bigint);
  2. Keep identifiers that aren't quantities (phone numbers, codes with leading zeros) as strings and compare them as strings.

Reproduce it safely

SELECT CAST('3000000000' AS int);  -- Msg 248

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.