In t-SQL for sql server 2000, the ROUND function has two options
0) normal math rounding (if its less than 5, round down, if its 5 or
greater, round up)
1) round down, reguardless of the number (aka truncate)
Is there any function that will round UP instead of round down? My only
other alternative is to write a UDF, which, in my expierence would kill the
performance of the query.
Thanks,
-- JasonCeiling
select ceiling(12.22)
http://sqlservercode.blogspot.com/|||And it's got a counterpart: FLOOR.
ML
http://milambda.blogspot.com/|||If you care about getting an integer only, use CEILING as suggested by
others. If you care about finer granularities, you can use the following
expression:
ceiling(<value>*power(10, <accuracy> ))/power(10, <accuracy> )
BG, SQL Server MVP
www.SolidQualityLearning.com
www.insidetsql.com
"Jason" <jason@.acd.net> wrote in message
news:ftadnapv46CT5l_eRVn-uA@.giganews.com...
> In t-SQL for sql server 2000, the ROUND function has two options
> 0) normal math rounding (if its less than 5, round down, if its 5 or
> greater, round up)
> 1) round down, reguardless of the number (aka truncate)
> Is there any function that will round UP instead of round down? My only
> other alternative is to write a UDF, which, in my expierence would kill
> the performance of the query.
> Thanks,
> -- Jason
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment