Total Pageviews

2019/03/10

[Database] [Sybase] arithmetic overflow error

Problem
When I try to sum up a integer column in Sybase, I get arithmetic overflow error, how to fix it?
SELECT SUM(columnname) 
FROM tablename

How-To
Simply cast this column to big integer can solve this problem, the updated query SQL statement is as bellows;
SELECT SUM( cast(columnname as BIGINT)) 
FROM tablename

No comments: