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 - 2004-08-01 : 18:16:50
|
| when using select 1/2 the result is 0How can I get 0.5 ?Thanks |
|
|
gpl
Posting Yak Master
195 Posts |
Posted - 2004-08-01 : 18:35:24
|
| The interpreter thinks you are using integers, add decimal places, ieselect 1.0 / 2.0if using columns in a select that are integer values, cast them to numeric first. |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-08-01 : 18:53:40
|
| Like this: SELECT CAST(1 AS DECIMAL(3,2))/CAST(2 AS DECIMAL(3,2))MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|