开发者

SQL COUNT overflow

开发者 https://www.devze.com 2023-02-24 00:21 出处:网络
Here is my query: SELECT COUNT(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0 Here is the result:

Here is my query:

SELECT COUNT(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0

Here is the result:

Msg 8115, Level 16, State 2, Line 1

Arithme开发者_开发知识库tic overflow error converting expression to data type int.

The table has 4 billion rows. I don't expect this query to be fast, but after about 5mins, it fails with an overflow error. Is there a COUNT function for bigger data than int?

Thanks.


Use COUNT_BIG

SELECT COUNT_BIG(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0


  SELECT COUNT_BIG(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0
0

精彩评论

暂无评论...
验证码 换一张
取 消