Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Arithmetic overflow error converting numeric to da

Author  Topic 

stahorse
Yak Posting Veteran

86 Posts

Posted - 2012-10-08 : 03:52:22
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.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-10-08 : 05:03:26
DECIMAL(6,2) means:
- a total of 6 digits
- 4 digits to the left of the decimal point
- 2 digits to the right of the decimal point

So maybe 4 digits to the left are not enough?

Try DECIMAL(12,2) for example...


Too old to Rock'n'Roll too young to die.
Go to Top of Page

stahorse
Yak Posting Veteran

86 Posts

Posted - 2012-10-08 : 06:15:37
Thank you it worked.
Go to Top of Page
   

- Advertisement -