14,664,481 members
Rate this:
See more:
Dear,

I have a field called T_Amount data type is float,

e.g= T_Amount=11800

When i make formula in query (11800/24)*35.25=17331.25

but actually if i make in calculator (11800/24)*35.25=17331.24999

i want this full figure.

Is i need to change the data type?

What I have tried:

i was using float for amount. when i was doing divide result is not accurate
Posted
Updated 13-Apr-16 9:23am
Richard MacCutchan 12-Apr-16 6:03am

Never use float for financial amounts. Use integer or decimal.

Rate this:

## Solution 1

Try this query,

`SELECT CAST((11800.00/24.00) as DECIMAL(20,5)) * 35.25`
Rate this:

## Solution 2

`SELECT (CONVERT(DECIMAL,11800)/24)  * 35.25`

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 110 Richard MacCutchan 100 allagi.arun 30 Sandeep Mewara 30 fjdiewornncalwe 10
 OriginalGriff 4,343 Richard MacCutchan 3,095 CPallini 1,930 Sandeep Mewara 1,375 Patrice T 1,104

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100