October 8, 2012 at 1:53 am
Hi
I have this code:
SELECT
[Policy_Id] = SNAP.POLICY_ID
,[Mex_Id] = FR.INV_PTF_NAME
,[Rebate_Amount_Gross] = ISNULL(CONVERT(DECIMAL(6,2),((FR.REBATE_RATE * SNAP.TOTAL_UNITS)/100)), 0.00)
and I get this error:
Arithmetic overflow error converting numeric to data type numeric.
please help.
October 8, 2012 at 2:58 am
hoseam (10/8/2012)
HiI have this code:
SELECT
[Policy_Id] = SNAP.POLICY_ID
,[Mex_Id] = FR.INV_PTF_NAME
,[Rebate_Amount_Gross] = ISNULL(CONVERT(DECIMAL(6,2),((FR.REBATE_RATE * SNAP.TOTAL_UNITS)/100)), 0.00)
and I get this error:
Arithmetic overflow error converting numeric to data type numeric.
please help.
Examine the Rebate_Amount_Gross values and check for yourself if they will fit into a decimal (6,2);
SELECT
[Policy_Id] = SNAP.POLICY_ID
,[Mex_Id] = FR.INV_PTF_NAME
,x.[Rebate_Amount_Gross]
FROM ...
CROSS APPLY (SELECT [Rebate_Amount_Gross] = (FR.REBATE_RATE * SNAP.TOTAL_UNITS)/100) x
ORDER BY x.[Rebate_Amount_Gross] DESC
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply