SQL 计数溢出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5643641/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL COUNT overflow
提问by user593062
Here is my query:
这是我的查询:
SELECT COUNT(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0
SELECT COUNT(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0
Here is the result:
结果如下:
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.
Msg 8115, Level 16, State 2, Line 1
将表达式转换为数据类型 int 时出现算术溢出错误。
The table has 4 billion rows. I don't except 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?
该表有 40 亿行。我不希望这个查询很快,但是大约 5 分钟后,它失败并出现溢出错误。是否有COUNT
比 int 更大数据的函数?
Thanks.
谢谢。
回答by pstrjds
回答by Sanjeevakumar Hiremath
SELECT COUNT_BIG(*) FROM Similarities WHERE T1Similarity = 0 OR T2Similarity = 0