on 2013 Sep 18 11:36 AM
COUNT_BIG returns an integer, not a bigint...
SELECT @@VERSION, EXPRTYPE ( 'SELECT COUNT_BIG() FROM dummy', 1 ) AS "COUNT_BIG"; @@VERSION,COUNT_BIG '12.0.1.3298',int @@VERSION,COUNT_BIG '16.0.0.1512',integer
...so it doesn't live up to its promises.
Is it time for an EBF? ... SQL Anywhere Network Server Version 16.0.0.1512
The following fails on a database with only 8 user tables and 18 user columns...
There was an error reading the results of the SQL statement. The displayed results may be incorrect or incomplete. Value SUM() out of range for destination SQLCODE=-158, ODBC 3 State="22003" SELECT COUNT_BIG(*) FROM SYSCOLUMN AS A CROSS JOIN SYSCOLUMN AS B CROSS JOIN SYSCOLUMN AS C;
This fails too, and it shouldn't...
There was an error reading the results of the SQL statement. The displayed results may be incorrect or incomplete. Value 4502884 * 2122 out of range for destination SQLCODE=-158, ODBC 3 State="22003" SELECT COUNT_BIG(*) * COUNT_BIG(*) * COUNT_BIG(*) FROM SYSCOLUMN AS A
It works if you CAST, but you shouldn't have to...
SELECT CAST ( COUNT_BIG(*) AS BIGINT ) * CAST ( COUNT_BIG(*) AS BIGINT ) * CAST ( COUNT_BIG(*) AS BIGINT ) FROM SYSCOLUMN AS A cast(COUNT_BIG() as bigint)*cast(COUNT_BIG() as bigint)*cast(COUNT_BIG() as bigint) 9555119848
User | Count |
---|---|
68 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.