Wednesday, March 7, 2012

Decimal Places Displayed

Hi,

I'm running the following query against a SQL Server 2003 database to receive the results below:

SELECT PayPeriod AS [Pay Period], SUM(PayHours) AS [Pay Hours]
FROM EmployeePayHours
GROUP BY PayPeriod

Pay Period Pay Hours

713 80

714 120

717 59.5

718 80

719 80

A colleague of mine, however, is running the same query against the same database (using a different machine) and gets the following results.

Pay Period Pay Hours

713 80

714 120

717 59.500000000000021

718 79.999999999999972

719 79.999999999999972

Is there a setting somewhere that needs to be changed? Thanks.

This seems specious at best.

Are you certain that it is the exact same query running against the exact same database and the exact same table? (In the second example, it appears that the [Pay Hours] are either stored as floats, or that there is conversion to floats occurring some where in the process.)

No comments:

Post a Comment