```
DECLARE @v DECIMAL(8,3)
DECLARE @x DECIMAL(8,3)
SET @v = 4.839
SET @x = 0.001
CREATE TABLE #tt ([V] DECIMAL(8,3), [AkaModuloV] DECIMAL(8,3), [RoundedV] DECIMAL(8,3))
WHILE (@v<4.85)
BEGIN
SET @v = @v + @x
INSERT INTO #tt([V], [AkaModuloV], [RoundedV])
SELECT @v AS [V], (@v - ROUND(@v, 2)) AS [AkaModuloV], [RoundedV] = CASE
WHEN ((@v - ROUND(@v, 2))=0.000) THEN @v
WHEN ((@v - ROUND(@v, 2))<0.000) THEN ROUND(@v, 2)
WHEN ((@v - ROUND(@v, 2))>0.000) THEN ROUND(@v + (0.009 - (@v - ROUND(@v, 2))), 2)
END
END
SELECT *
FROM #tt
DROP TABLE #tt
```

Results:

```
V AkaModuloV RoundedV
4.840 0.000 4.840
4.841 0.001 4.850
4.842 0.002 4.850
4.843 0.003 4.850
4.844 0.004 4.850
4.845 -0.005 4.850
4.846 -0.004 4.850
4.847 -0.003 4.850
4.848 -0.002 4.850
4.849 -0.001 4.850
4.850 0.000 4.850
```