FIX: Dividing 0 by a Negative Decimal or Numeric Number Results in -0 (285544)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q285544
BUG #: 203148 (SHILOH_bugs)
SYMPTOMS
When using decimal or numeric data types, if you divide 0 by a negative number, a negative 0 (-0) is returned.
RESOLUTIONTo resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the
Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
WORKAROUND
Check for 0 before you perform the division and avoid the division if 0 is involved; for example:
declare @v1 dec(10, 2), @v2 dec(2, 1), @v3 dec (10,2)
-- @v3 is the result of @v1/@v2
select @v1 = 0.0, @v2 = -1.0
if @v1 = 0
select @v3 = 0.0
else
select @v3 = @v1 / @v2
STATUSMicrosoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.
Modification Type: | Major | Last Reviewed: | 10/16/2003 |
---|
Keywords: | kbBug kbfix kbSQLServ2000sp1fix KB285544 |
---|
|