Link to home
Start Free TrialLog in
Avatar of Rubicon2009
Rubicon2009

asked on

SQL Server Management Studio is automatically rounding my calculation

Hi !

SQL Server Management Studio is automatically rounding my calculation done in TSQL in the result pane. How can I avoid this.

Thank You !
Avatar of Aaron Tomosky
Aaron Tomosky
Flag of United States of America image

You can
Select cast(field as decimal(18,2)) from table

If you give us your query and sample data we can give more specific help.
Avatar of Rubicon2009
Rubicon2009

ASKER

SELECT (A.ActualEnd - A.ActualStart - Isnull(A.Lunch, 0)) / 60 AS 'FinalDuration'

with real values, the result will be 7 instead of 7,25
SELECT (780 - 300 - 45) / 60

FYI, values are minutes from midnight
printscreen.png
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Using CAST like suggested is still giving me the wrong results, I now optain 7.00 instead of 7.25
(780 - 300 - 45) / 60.0
Is resulting 7.25000

:)
Thank You