Closed. This question needs details or clarity . It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post .
Closed 2 days ago.
Improve this question
In SQL Server, how can I transform the value 8796842.09999999 into 8796842.0500 ?
I tried the round
function, but it doesn't work
1条答案
按热度按时间jckbn6z71#
You can use the expression which yields 8796842.05 for the given value:
The second argument of the ROUND function specifies the number of decimal places. Since we handle the decimal places by multiplying 20 already, we set this parameter to 0.
The third argument means round if 0, and truncate otherwise.
Multiplying by 20 before truncating and dividing by 20 afterwards truncates at every 0.05 (1/20) step.
See: ROUND (Transact-SQL)