SQL Syntax for rounding up

I've got numbers like 3.32 and 3.87 that I calculate and I would like them to both round up to 4 however what I'm getting is rounding down.

Looking at some other questions that were answered I thought this might pull it off but to no avail?

CAST(ROUND(CAST(C.TRANS_QTY AS decimal(18,2)),0) AS INT) AS ROUNDED_QTY,

This does deliver a '0' decimal but it is not rounding up. i suspect I have the cast and round bits scewing with one another.

Thanks!
ghettocounselorPharmacy Systems AdminAsked:
Who is Participating?
 
Tony303Connect With a Mentor Commented:
SELECT CEILING(yourNumber)
0
 
Kelvin SparksCommented:
What version of SQL SErver. Froim 2008r2 there is the roundup function.
ROUNDUP(C.TRANS_QTY,0) should do it.


Kelvin
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Kelvin SparksCommented:
You may also need a cast statement with the column being passed.

Kelvin
0
 
Tony303Commented:
SELECT CEILING(CAST(C.TRANS_QTY AS decimal(18,2))) AS ROUNDED_QTY
0
 
deviprasadgCommented:
CAST(CEILING(C.TRANS_QTY) AS INT)  AS ROUNDED_QTY,
0
 
Anthony PerkinsCommented:
Froim 2008r2 there is the roundup function.
ROUNDUP(C.TRANS_QTY,0) should do it.

Not in T-SQL.  I suspect you are thinking of DAX functions.
0
 
ghettocounselorPharmacy Systems AdminAuthor Commented:
in SQL Server 2008 R2 ceiling worked, there seems to be no 'roundup' command.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.