Rounding in SQL Server

I need to round several data types, the number of which is closest to 2 places in SQL Server

For instance,

Input:  123.10000000
Output: 123.10

Thanks and Regards,
Ismail

+3
source share
4 answers

You will need to convert it:

Select Convert(numeric(19,2), @value)

You can use the Round function to do rounding:

Select Round(@Value, 2)

+6
source

Will it CONVERT(DECIMAL(12,2), ROUND(123.10000000, 2))do the trick?

+2
source

You can try:

select round(123.10000000, 2)

or

select cast(123.10000000 as decimal(12,2))
+1
source
SELECT CAST(ROUND(InputValue, 2) AS money) AS OutputValue
+1
source

Source: https://habr.com/ru/post/1790644/


All Articles