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 |
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-23 : 16:56:23
|
| Hey, I have a question. I would like to know if i could round this for eg. 2.31 i need this to round to 3If someone could help me out it would be great. I am on a deadline.Thank you |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-02-23 : 16:59:58
|
| select ceiling(2.31)rockmoose |
 |
|
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-23 : 17:07:39
|
| Thank you soooooooo much . |
 |
|
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-24 : 13:56:34
|
| Hey , I just found out they dont want the calculation to be like that for eg between 2.1 and 2.4 i need this to be rounded to 2.And the other thing is let me first explanin what i have to do for this stor proclets say tableA has 3 rows i need to find out what is 10% of that 3 eg 3*.1 = .3 (this should show 0)eg2. table B has 39 rows -- 39*.1 = 3.9 this should show 4so now accourding to this result i need to select that particular row setright now i was doing Select n Percentage * from table for the eg i gave u the SQL would pick 1 row for table Aand 4 for table BNOW I NEED TO DO A SELECT WHERE I WOULD GET 0 ROWS FOR TABLE AAND 4 FOR TABLE BPLEASE IF SOMEONE COULD HELP ME OUT IT WOULD BE GREAT. thank you,Mattie |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-02-24 : 14:26:44
|
Something like this ?declare @rows intselect @rows = round(0.1*count(*),0) from sysobjectsset rowcount @rowsselect * from sysobjects where @rows > 0 -- if rowcount is 0, that means all rowsset rowcount 0 -- reset Edit: replace sysobjects for your table, it was just an axamplerockmoose |
 |
|
|
MattieBala69
Starting Member
30 Posts |
Posted - 2005-02-24 : 14:55:16
|
| thank u soo much |
 |
|
|
|
|
|