• SQL Kiwi (1/3/2012)


    steven.malone (1/3/2012)


    Very interesting.

    Declaring the decimal variables as DECIMAL(35,20) gives the correct result.

    But declaring the decimal variables as DECIMAL(35,19) gives the rounded result.

    Two DEC(35,20) multiplied gives a result of (71,40). Precision 71 exceeds the available 38 by 33, so scale is reduced by 33 to 7. Result is DEC(38,7) and the result is correct.

    Two DEC(35,19) multiplied gives a result of (71,38). Precision 71 exceeds the available 38 by 33, so scale is reduced by 33 to 5. However, minimum scale is 6, so the result is DEC(38,6) with a risk of very large values causing an error, and the result is rounded to 6 decimal places.

    @paul-2

    I need a clarification here.

    Microsoft article states that the minimum scale of a decimal can be 0.

    http://msdn.microsoft.com/en-us/library/ms187746.aspx

    So I don't get the point where the minimum scale is defined as 6