tsql - T-SQL - how to round DOWN to nearest .05 -


The database I am using is SQL Server 2005. I am trying to fill the values ​​in the nearest value .05 (nickel).

So far I have:

SELECT ROUND (number to turner / 5, 2) * 5

Which To evaluate approximately < 1.95 , 2 , No, 1.99 / Strong>.

Specify the non-zero values ​​for the third parameter instead of the triangle:

< Pre> SELECT ROUND (numberToBeRounded / 5, 2, 1) * 5

Note: Going from zero to side towards zero, but it only makes a difference if You can use the floor function to round negative values, but you can not specify the number of decimals. So that you should multiply instead of dividing:

  SELECT FLOOR (number ToBeRounded * 20) / 20  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -