Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange rounding
Message
De
12/04/2012 15:40:57
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01541246
Message ID:
01541256
Vues:
27
>>Hi,
>>
>>I have this query:
>>
>>
select Cases.Fee
>>		,ApplicationCodes.TaxRate
>>		,newcalc = round(cases.Fee * ApplicationCodes.TaxRate, 2)
>>	from Cases 
>>	left outer join ApplicationCodes on 1=1
>>where ID = 2367
>>
>>In this case Fee = 2971.50 and Taxrate = 0.15
>>
>>so by my math newcalc = 2971.50 * 0.15 = 445.725
>>
>>which when rounded to 2 decimal places I should get 445.73
>>
>>Why would SQL Server be returning 445.72?
>
>What are the types of these columns?

Thanks I solved it. The types were float and money. Casting to numeric fixes it.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform