Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to round 2.1 to 3?

Author  Topic 

lavenzo
Starting Member

7 Posts

Posted - 2013-05-03 : 02:19:33
Hi, i have no idea how to round the result in SQL. What I want is if the AVG(somecolumn) return me the result is 2.1 then I would like to round it to 3.

Any idea?

Thanks.!

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-05-03 : 02:34:08
You can use CEILING function
SELECT CEILING(2.1), CEILING(-2.1), CEILING(0.0)
GO

http://msdn.microsoft.com/en-us/library/ms189818.aspx

--
Chandu
Go to Top of Page

lavenzo
Starting Member

7 Posts

Posted - 2013-05-03 : 03:16:17
Thanks! It works!
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-05-03 : 09:15:07
quote:
Originally posted by lavenzo

Thanks! It works!


Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -