sql server 2008 R2
initial Query for review;
SELECT
SUM(CASE WHEN ACCT_UNIT = '90015' AND ACCOUNT = '1251' THEN TRAN_AMOUNT ELSE 0 END) AS AR FROM GLTRANS
This returns 50881616.07
desired result is 5088161607. No decimal.
Tried using cast as int, query below for review;
SELECT SUM(CASE WHEN ACCT_UNIT = '90015' AND ACCOUNT = '1251' THEN CAST(TRAN_AMOUNT*100 AS INT) ELSE 0 END) AS AR FROM GLTRANS
but
getting; Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.
Appreciate help with this.
Thanks in advance, zaw
initial Query for review;
SELECT
SUM(CASE WHEN ACCT_UNIT = '90015' AND ACCOUNT = '1251' THEN TRAN_AMOUNT ELSE 0 END) AS AR FROM GLTRANS
This returns 50881616.07
desired result is 5088161607. No decimal.
Tried using cast as int, query below for review;
SELECT SUM(CASE WHEN ACCT_UNIT = '90015' AND ACCOUNT = '1251' THEN CAST(TRAN_AMOUNT*100 AS INT) ELSE 0 END) AS AR FROM GLTRANS
but
getting; Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.
Appreciate help with this.
Thanks in advance, zaw