DooDoo
DooDoo

Reputation: 13467

SQL Server 2014 Round Function

I'm using SQL Server 2014 and I read this MSDN page for ROUND function: ROUND (Transact-SQL)

When I run this example from above page, the result of my is not same as MSDN result:

MSDN:

SELECT ROUND(123.4545, 2)  -->  123.45 

My result:

 SELECT ROUND(123.4545, 2)  -->  123.4500

There are two extra zeros in my result. Where is the problem? I want to have MSDN result.

Thanks

Upvotes: 1

Views: 306

Answers (1)

StackUser
StackUser

Reputation: 5398

You have given 4 decimals so you would get results in 4 decimals.

Try like this,

SELECT convert(DECIMAL(8, 2), ROUND(123.4545, 2))

Upvotes: 5

Related Questions