Kajah User
Kajah User

Reputation: 591

Arithmetic overflow error converting money to data type numeric

This is my query I am inserting a values in the in the temp table, but I am getting the error like this..

Arithmetic overflow error converting money to data type numeric.

Query is:

DECLARE @EBT money
Declare @ConversionRatio money
Declare @TotalRevenues money

insert into #SummarySheet(Item,INR,Dollar,Percentage) 
VALUES ('EBT', isnull(@EBT,0), isnull(@EBT,0)/isnull(@ConversionRatio,0), 
         isnull(@EBT,0)/isnull(@TotalRevenues,0))

FYR:

The values are:

@TotalRevenues="1.00"
@EBT="-50995944.26"
@ConversionRatio="44.5"

How to rectify it....

Upvotes: 1

Views: 14648

Answers (2)

gbn
gbn

Reputation: 432431

Your table isn't money.

It's numeric (decimal): and not wide enough for the calculated value

Also, to avoid divide by zero errors, these 2 calculations

isnull(@EBT,0)/isnull(@ConversionRatio,0)
isnull(@EBT,0)/isnull(@TotalRevenues,0)

should be

isnull((@EBT / NULLIF(@ConversionRatio,0)), 0)
isnull((@EBT / NULLIF(@TotalRevenues,0)), 0)

Upvotes: 1

jack.mike.info
jack.mike.info

Reputation: 128

Arithmetic overflow error

Destination data type do not have capacity to handle the space

kindly increase the space

Upvotes: 1

Related Questions