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
 General SQL Server Forums
 New to SQL Server Programming
 divide problem

Author  Topic 

ranganaath
Starting Member

18 Posts

Posted - 2011-01-28 : 15:11:32
hi
my sql is

select a.vCBS,a.vBTLS,a.vCBS+(a.vBTLS/b.vNBPC) as TOTALCBS,b.vNBPC
from dbo.tblTransaction a,tblItemMaster b
where a.vitemcode=b.vitemcode
and b.vNBPC>0 and a.vBTLS>0

NBPC =no of bottles per case

if vBTLS=24 and vNBPC=48 the TOTALCBS is showing zero

ranganath

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-01-28 : 15:14:15
An integer divided by an integer is an integer, thus the 0
.vCBS+(a.vBTLS*1.0/b.vNBPC)

Jim


Everyday I learn something that somebody else already knew
Go to Top of Page

ranganaath
Starting Member

18 Posts

Posted - 2011-01-28 : 15:18:08

Thank you very much

ranganath
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-29 : 11:10:16
see

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -