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 |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2014-07-01 : 19:52:03
|
Dear All,I am processing some list of records and applying the ratio, after that i need to apply the round off fraction to next figure,how can we do this in t-sql.Ex: 29.4545 --> 3017.1349 --> 18 16.0201 --> 17anything fraction digit should come to next round off figures. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-07-01 : 20:35:00
|
[code] CEILING ( <number> ) [/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2014-07-14 : 01:46:50
|
quote: Originally posted by khtan
CEILING ( <number> ) KH[spoiler]Time is always against us[/spoiler]
|
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2014-07-14 : 01:48:00
|
Hi,even if i need to do the samething for negative number to 0 Ex:select (-10.33) --> 1select (10.22) --> 11select (10.9133) --> 11 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-07-14 : 03:16:22
|
quote: Originally posted by gangadhara.ms Hi,even if i need to do the samething for negative number to 0 Ex:select (-10.33) --> 1
This is unusualall negative number return as 1 ?use CASE statement to do that KH[spoiler]Time is always against us[/spoiler] |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2014-07-14 : 12:38:02
|
Sorry it was my mistake, all negative number should return 0 select (-10.33) --> 0 All negative number should return to 0 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-14 : 12:59:47
|
select case when yourcolumn > 0 then ceiling(yourcolumn) else 0 end...Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|