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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 round

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2004-08-01 : 18:16:50
when using select 1/2 the result is 0
How 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, ie
select 1.0 / 2.0
if using columns in a select that are integer values, cast them to numeric first.
Go to Top of Page

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))



MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -