SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to round 2.1 to 3?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lavenzo
Starting Member

7 Posts

Posted - 05/03/2013 :  02:19:33  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2215 Posts

Posted - 05/03/2013 :  02:34:08  Show Profile  Reply with Quote
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 - 05/03/2013 :  03:16:17  Show Profile  Reply with Quote
Thanks! It works!
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2215 Posts

Posted - 05/03/2013 :  09:15:07  Show Profile  Reply with Quote
quote:
Originally posted by lavenzo

Thanks! It works!


Welcome

--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000