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 |
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2007-09-13 : 10:19:11
|
Hi,How can I get this query to return 0.1 ?select 10/100it currently returns 0Thanks |
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2007-09-13 : 10:24:18
|
select 10/100.0, 10/cast(100 as smallmoney)PS: If anyone is interested in a SQL Server job in Connecticut with excellent pay send me a resume to ValterBorges@msn.com |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-13 : 10:24:34
|
By NOT using integer divisionselect 10.0 / 100.0select 1.0 * 10 / 100 E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-13 : 10:46:07
|
It is becuase result becomes integer when both numerator and denominator are integers. You need to force one operand to be decimalMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|