# Arithmetic Overflow error converting expression to data type int inserting records [duplicate]

while I inserting records in a table it throws :

Arithmetic overflow error converting expression to data type int.

Code:

``````create table JEmp
(
J_Id int Identity,
J_Name varchar(100),
J_Contact int,
J_City varchar(100),
primary key(J_Id)
)

insert into JEmp(J_Name, J_Contact, J_City)
values ('David Warner', 9821766418, 'New York')
``````

## 3 Answers

It's because `9821766418` is greater than the integer maximum of `2147483647`.

If you want to be able to store phone numbers, you need to use a `BIGINT`, or even better, store them as a string. You'll either be searching for them by a direct equality, or a partial condition anyway. Storing them as a number doesn't really help you in any way, here.

Int datatype's max limit is 2147483647. Based on the wiki - you should store phone numbers as strings (varchar or nvarchar).

Adding to the other answers, you could use the numeric datatype for large numbers. If, for instance, you’re working with phone numbers that go to ten digits, you can use `numeric(10, 0)`, meaning a number of (up to 10 digits, 0 of which are to the right of the decimal point).

While bigint ”only” goes to about 19 digits, you can go all the way to 38 with numeric, but numeric does use a little more storage space for each equivalent value, compared to int/bigint. However, numeric still uses about half of the storage of a comparable varchar.

• The problem with using numeric (and int and bigint) for phone numbers is that numbers like `123456789` and `0123456789` and `00123456789` will be treated as the same number. The leading 0s are lost. Jun 25, 2018 at 18:54