Arithmetic overflow error converting float to data type numeric

Hello guys,

I have a query that is resulting me an error:

Arithmetic overflow error converting float to data type numeric

convert(numeric(14,2),round(convert(numeric(17,8),qtdpro)*round(convert(numeric(17,8),prunit)*convert(numeric(17,8),(1-(a.pdes/100)) ), dbo.fn_DigitosValor())  +convert(numeric(17,2),(a.FRETE+a.SEGURO+a.OUTDESP),2),2)) as BASCSLL
from aripco a,arpco b 
where (a.numped = b.numped and a.seqped = b.seqped) 
  and qtdpro > 0 
  and prunit > 0 
  and b.flagoriginal = 0 

Open in new window

How could I get the row that is resulting me this error?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

larryhSr. Software EngineerCommented:
You will want to look at the definition of how large/precise a float can be compared to a numeric.  Also, a float is by definition "approximate" while a numeric is "precise".
Microsoft docs say
Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly.
.  See

You probably have a float that is larger (either positive or negative) than the maximum/minimum values for numeric.  Look up the definition of numeric and do a query where the float value is above/below the maximum/minimum.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hidrauAuthor Commented:
Thanks a lot
hidrauAuthor Commented:
thanks a lot
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.