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 |
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2010-11-26 : 08:57:58
|
| I'm sure this is really simple, but if I use the following why do I get 0?select (50 / 200) * 100I'd expect to see 25 |
|
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2010-11-26 : 09:02:50
|
| Managed to figure this out althought it seems a bit strange to have to do this:select convert(decimal(18,2),(1.0 * 50/200 * 100)) |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-11-26 : 09:03:27
|
| integer arithmetic - both ints so result is truncated to inttryselect (50 / 200) * 100.0orselect 1.0 * (50 / 200) * 100==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
chris_cs
Posting Yak Master
223 Posts |
Posted - 2010-11-26 : 11:24:10
|
| Thanks for the info guys! |
 |
|
|
|
|
|