2
votes

I am getting an error after firing this query.

select COUNT(*) 
from [DB1].dbo.Transaction(nolock) t 
join [DB2].dbo.visits (nolock) v 
on t.V_ID=v.V_ID 
where t.Ct_ID=11  
and t.Timestamp>'06-08-2015' 
and v.C_ID is null

Error:

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

1
Try using COUNT_BIG - Felix Pamittan

1 Answers

5
votes

Try using COUNT_BIG instead of COUNT.

Read this article for more information. Additionally, this shows the limits for the different types of INTs.