# Thread: Show column with integer value to decimal

1. Registered User
Join Date
Apr 2004
Posts
54

## Unanswered: Show column with integer value to decimal

Hi!!
I must execute this decimal operation:
(column1 / (1 + (column2 / 100)))

column1 and column2 are decimal(16,2) with a few integer value exmple:
22,33
283
123,13

It doesn't work..why?? ..for example:
-- Yes
(300.00 / (1 + (column2 / 100)))
-- No :-(
(300/ (1 + (column2 / 100)))
and i return this:

"
SQL0419N
A decimal divide operation is not valid because the result would have a negative scale.

Explanation: A specified decimal division is not valid because it will result in a negative scale.
The formula used internally to calculate the scale of the result for decimal division is:
Scale of result = 31 - np + ns - ds where np is the precision of the numerator, ns is the scale of the numerator, and ds is the scale of the denominator.

User Response:
Examine and ensure the precision and scale of all columns that may participate in a decimal division. Note that an integer or small integer value may be converted to a decimal for this calculation.

sqlcode: -419 sqlstate: 42911
"

Thank you very much.
Fabio
Last edited by petitof; 07-23-08 at 06:07.

2. Registered User
Join Date
May 2003
Location
USA
Posts
5,737
Try putting decimals in all your literals (1.0 and 100.0).

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•