|
Posted by Hugo Kornelis on 01/26/06 00:50
On 25 Jan 2006 14:12:48 -0800, Chris wrote:
(snip)
>-- Divide the total calls offered by the total calls answered in X
>multiplied by 100 to find current GOS ????
>
>set @GOS = (@offered)/(@answeredin120)*100
>
>select @GOS
>
>The problem is my GOS is being returned as 100 when it is really apprx
>77%.
>Where did I go wrong?
Hi Chris,
Integer division: divide two integers, the result is integer too.
SELECT 1/3
SELECT 1.0/3
SELECT 1/3.0
SELECT 1.0/3.0
The above show that forcing at least one operand to non-integer suffices
to get a result with fraction. In your case, one possible way would be
SET @GOS = CAST(@offered AS decimal(10,2)) / @answeredin120 * 100
Or even
SET @GOS = 100.0 * @offerec / @answeredin120
--
Hugo Kornelis, SQL Server MVP
Navigation:
[Reply to this message]
|