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)
 Help on Calculation

Author  Topic 

mayoorsubbu
Yak Posting Veteran

95 Posts

Posted - 2008-10-14 : 07:31:15
Hi Folks,

Select (6/12) * 5 returns 0
How do i make it return 2.5 and round it to the nearest decimal

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-14 : 07:48:19
By NOT using integer division.

SELECT (6/12.0) * 5


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-14 : 08:20:21
Here is why
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx

Madhivanan

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

mayoorsubbu
Yak Posting Veteran

95 Posts

Posted - 2008-10-14 : 10:13:58
Thank you buddies,

It was an education
Go to Top of Page
   

- Advertisement -