sql sever arithmetic overflow error converting expression to data type int

This problem is caused by the large data size, and the data type needs to be converted

SELECT SUM(CONVERT(bigint, MILEAGE)) AS MILEAGE FROM TABLE GROUP BY XXX

 At first, MILEAGE is of int type, first converted to bigint and then summed

 

Reference URL: http://zhidao.baidu.com/link?url=0FkWDsFNtdWu3WwZVjpgY3HzKlRFC70aenG3eYYvzOloa3tlKhLSCSyJCsqSiyieYz86QBBIsZQ_2f1WkoH2sXig9lxP9c7JHZk7S1o6uJq

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326848052&siteId=291194637