Numeric and Decimal Data types support divisions only up to 32 digits above 0. - by SlavaSQL

Status : 

 


1
0
Sign in
to vote
ID 996487 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 10/9/2014 8:27:15 AM
Access Restriction Public

Description

I've tried to divide a number with more than 32 digits above 0 and got following error:
----------------------------------------------------------------------
Msg 8115, Level 16, State 2, Line 40
Arithmetic overflow error converting expression to data type numeric.
----------------------------------------------------------
I assume that in case of division if the result has more than 32 digits above 0 it produces an error.
In the second example I show that multiplication works, but division do not with exact same expected result.

It looks like in case of division the result is changing it's type from NUMERIC(38,0) to NUMERIC(38,6).

Third example shows that if we separate division and multiplication into two different statements that would be a workaround.
----------------------------------------------------------
Exact Version:
Microsoft SQL Server 2012 - 11.0.5532.0 (X64) 
	Jul 14 2014 15:00:27 
	Copyright (c) Microsoft Corporation
	Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.2 <X64> (Build 9200: )

Sign in to post a comment.
Posted by Microsoft on 10/16/2014 at 2:56 PM
Thanks for submitting this feedback.

The behavior may seem counter-intuitive, but we may not be able to change it due to potential back-compat concerns.
There are, however, potential ways to enable this scenario using alternative syntax.
We will consider this for a future release.


--
Jos de Bruijn - SQL Server PM
Posted by Microsoft on 10/16/2014 at 2:56 PM
Thanks for submitting this feedback.

The behavior may seem counter-intuitive, but we may not be able to change it due to potential back-compat concerns.
There are, however, potential ways to enable this scenario using alternative syntax.
We will consider this for a future release.


--
Jos de Bruijn - SQL Server PM