X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2.
How can I do this with SQL?
? Use the CIELING function: SELECT CIELING(x/10) FROM YourTable -- Adam MachanicPro SQL Server 2005, available nowhttp://www..apress.com/book/bookDisplay.html?bID=457-- <JIM.H.@.discussions.microsoft.com> wrote in message news:4165a8e6-3d64-4db1-9c4b-1cec7040f35a@.discussions.microsoft.com... X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2. How can I do this with SQL?|||use CEILING
select ceiling(0.4),ceiling(1.1)
Denis the SQL Menace
http://sqlservercode.blogspot.com/
|||you can use the round function
For Example:
SELECT round(4.9, 0)
Check out BOL for more details
AWAL
|||Not really, OP wanted 2 for 1.1
round gives 1
Denis the SQL Menace
http://sqlservercode.blogspot.com/
No comments:
Post a Comment