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.
| Author |
Topic |
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2008-09-03 : 08:57:32
|
| Hi i need to do the followingSELECT count(*) / 20 as [PageCount]FROM ShoppingBasket but the problem i have is if the page count is 43 then i need the [PageCount] to be 3 not 2 as i am getting nowjust not sure how to do this? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-03 : 08:59:25
|
SELECT ceiling(count(*) / 20.0) as [PageCount]FROM ShoppingBasket E 12°55'05.63"N 56°04'39.26" |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-09-03 : 09:00:40
|
| SELECT CEILING(Count(*)*1.0/20)Jim |
 |
|
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2008-09-03 : 09:36:58
|
| ok thanks, this is a stored proc and i have some asp code to retreive the data which isint count = (int)db.ExecuteScalar(cmd);return count;}this is now erroring when usingSELECT ceiling(count(*) / 20.0) as [PageCount]FROM ShoppingBasket any ideas? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-03 : 09:53:03
|
SELECT cast(ceiling(count(*) / 20.0) as int) as [PageCount]FROM ShoppingBasket E 12°55'05.63"N 56°04'39.26" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|