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 |
|
gangelo
Starting Member
6 Posts |
Posted - 2009-07-27 : 16:32:19
|
| All I want to do is compute the percent of answered questions:select (5/10)*100 as [Percent]and 0 is returned, what am I missing here? |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-07-27 : 16:52:57
|
| You are doing integer division.. try: select (5.0/10)* 100 as [Percent] |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-27 : 16:57:41
|
If 5 and 10 are columns are variables, change 100 to 100.0 N 56°04'39.26"E 12°55'05.63" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
gangelo
Starting Member
6 Posts |
Posted - 2009-07-28 : 09:05:25
|
| Thank you all, these solved it |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-28 : 09:13:36
|
quote: Originally posted by Peso If 5 and 10 are columns are variables, change 100 to 100.0 N 56°04'39.26"E 12°55'05.63"
In that case one of the variables should be multiplied by 1.0select (5/10)*100.0 as [Percent]select (1.0*5/10)*100 as [Percent]MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|