BUG: Zero May Be Negative, Depending on the Numeric Scale

ID: Q165376


The information in this article applies to:

BUG #: 16672

SYMPTOMS

Depending on numeric scale, a negative sign may be generated for the value of zero.

The following scripts demonstrate the problem:


   declare @i numeric(28,5), @j numeric(28, 5), @k numeric(28,5)
   select @i =  0.0
   select @j = -1.0
   select @k = @i * @j
   select @i, @j, @k

   where @k = 0.00000 versus

   declare @i numeric(28,6), @j numeric(28, 6), @k numeric(28,6)
   select @i =  0.0
   select @j = -1.0
   select @k = @i * @j
   select @i, @j, @k

   where @k = -0.000000 


WORKAROUND

To work around this problem, adjust the scale to avoid generating a negative zero. For example, use any scale between 1 and 5 to work around the problem described in the scenario above.


STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Keywords          : kbusage SSrvGen kbbug6.50 
Version           : 6.5
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 9, 1999