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



The information in this article applies to:

  • Microsoft SQL Server 6.5

This article was previously published under Q165376
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.

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbpending kbusage KB165376