Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 remainder round up

Author  Topic 

skillile
Posting Yak Master

208 Posts

Posted - 2002-09-30 : 22:30:25
I am looking to round up my calc so I always have at least a value of 1 in my return.

Here is what I want:

3/2 = 2
5/10 = 1
0/x = 1

I am trying:

DECLARE @pages int
SET @count = 100

SET @pages = ROUND(@count/30,1)
or
SET @pages = CEILING(@count / 30)

Any help:


Thanks



slow down to move faster...

ashok
Yak Posting Veteran

57 Posts

Posted - 2002-10-01 : 03:18:25
this should do it :

DECLARE @pages int
SET @count = 100
SET @pages = CEILING(@count / 30)
select case @pages
when 0 then 1
else @pages
end


Go to Top of Page
   

- Advertisement -