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
 Transact-SQL (2000)
 Division problem

Author  Topic 

rajesh_
Starting Member

8 Posts

Posted - 2007-06-12 : 02:51:44
Hi,

When i run " select (105/43200) " in Query analyzer it is printing 0 . But actual output should be 0.002.

I used CAST. But no luck its still printing 0.

Please suggest me.

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-06-12 : 02:55:41
select (105.0/43200.0) and round it to your no. of decimal

--------------------------------------------------
S.Ahamed
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-12 : 09:33:01
It is becuase by default it is converted to int datatype
You should change one of the values to float by multiplying it by 1.0

If you use variables in place of actual values, you can do

Select 1.0*@var/@var2

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -