How to fix error: Arithmetic overflow error converting expression to data type int

290 Views Asked by At

I just used count function in query statement but got an error as shown below:

SELECT count(*)
FROM [my_table_data]

Error messages:

Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.

Please help me to find the solution!

1

There are 1 best solutions below

1
Luis LL On

Try BIG_COUNT instead. I believe it's supported since SQL Server 2012

SELECT big_count(*) FROM [my_table_data]