Skip to content
Advertisement

SQL round percent up to nearest .1

I have a columns of percentages and i want them to always round up to the nearest .1

for example

.005 --> .1
.11 --> .2
.3256 -->.4
.6797 -->.7

I am trying ceiling and floor, but they give me all whole numbers

I have tried this, but it still rounds as it normally would work

round(n * 10, 0) / 10 as [nearest 0.10]

Advertisement

Answer

You can always use ceiling() and arithmetic:

select ceiling(percentage * 10) / 10.0
Advertisement