NerishaB
asked on
SQL Rounding to 2 decimal places
Hi,
How do I round of a decimal number to 2 decimal places?
My query contains:
TotalHours_Dec = datediff(minute, Min(ClockIn), MAX(ClockOut)) / 60.0
Which gives me a result of 11.36667
I would like it to display 11.37
How do I round of a decimal number to 2 decimal places?
My query contains:
TotalHours_Dec = datediff(minute, Min(ClockIn), MAX(ClockOut)) / 60.0
Which gives me a result of 11.36667
I would like it to display 11.37
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys all works well
TotalHours_Dec = Round(datediff(minute, Min(ClockIn), MAX(ClockOut)) / 60.0,2)
Try following:
Set @TotalHours_Dec = convert(decimal(12,2), datediff(minute, Min(ClockIn), MAX(ClockOut)) / 60.0)
TotalHours_Dec = convert(decimal(12,2), datediff(minute, Min(ClockIn), MAX(ClockOut)) / 60.0)
Thanks