select COUNT(*) 可以产生下一个错误吗?
Can select COUNT(*) produce the next error?
我正在使用 python 的 pypyodbc 在 SQL 服务器数据库上处理一些 sql 批量插入命令。然而,在我发现的日志中:
python load_d 4c24-4ea4 ENTER SQLExecDirect
HSTMT 0x000000000336C260
UCHAR * 0x0000000003A91188 [ 67] "\ a SELECT COUNT(*) \ a FROM out_table\ a "
SDWORD 67
python load_d 4c24-4ea4 EXIT SQLExecDirect with return code -1 (SQL_ERROR)
HSTMT 0x000000000336C260
UCHAR * 0x0000000003A91188 [ 67] "\ a SELECT COUNT(*) \ a
FROM out_table\ a "
SDWORD 67
DIAG [22003] [Microsoft][SQL Server Native Client 11.0][SQL Server]Arithmetic overflow error converting expression to data type int. (8115)
COUNT(*) 是否会返回一个“超出”INT 限制的非常大的值?
是的。它可以。为解决此问题,Microsoft 引入了 COUNT_BIG-function 请在此处查看详细信息 https://docs.microsoft.com/en-us/sql/t-sql/functions/count-big-transact-sql?view=sql-server-ver15
我正在使用 python 的 pypyodbc 在 SQL 服务器数据库上处理一些 sql 批量插入命令。然而,在我发现的日志中:
python load_d 4c24-4ea4 ENTER SQLExecDirect
HSTMT 0x000000000336C260
UCHAR * 0x0000000003A91188 [ 67] "\ a SELECT COUNT(*) \ a FROM out_table\ a "
SDWORD 67
python load_d 4c24-4ea4 EXIT SQLExecDirect with return code -1 (SQL_ERROR)
HSTMT 0x000000000336C260
UCHAR * 0x0000000003A91188 [ 67] "\ a SELECT COUNT(*) \ a
FROM out_table\ a "
SDWORD 67
DIAG [22003] [Microsoft][SQL Server Native Client 11.0][SQL Server]Arithmetic overflow error converting expression to data type int. (8115)
COUNT(*) 是否会返回一个“超出”INT 限制的非常大的值?
是的。它可以。为解决此问题,Microsoft 引入了 COUNT_BIG-function 请在此处查看详细信息 https://docs.microsoft.com/en-us/sql/t-sql/functions/count-big-transact-sql?view=sql-server-ver15