April 14, 2008 at 7:35 pm
I'm trying to round a number up to the next whole number in sql server 2005 query analyzer.
i.e. 12.2 needs to display as 13
I've tried the round function but the value displayed is 12. I researched online and found the 'int' function but sql server 2005 doesn't recognize this. I'm new to sql...done most of my calcs via excel. Anyone know how to do this?
April 14, 2008 at 8:08 pm
SELECT CEILING(CAST (12.2 AS FLOAT))
--Jeff Moden
Change is inevitable... Change for the better is not.
April 15, 2008 at 6:10 am
Thanks! This is exactly what I need.
April 15, 2008 at 6:12 am
... perfect... thanks for the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 13, 2012 at 7:24 am
Thanks for the posts, this helped me also!
January 2, 2018 at 12:00 pm
Thank you Jeff...!!!
Your post helped me to do my task, I really appreciate you....!!!
January 2, 2018 at 2:39 pm
Thanks for the feedback. Also consider the ROUND function. Use of the normally missed 3rd parameter can help solve certain problems.
https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply