Re: Inconsistent negative numerical values in SQL2K database table
From: Steve Kass (skass_at_drew.edu)
Date: 02/03/05
- Next message: William Wang[MSFT]: "RE: Errors: Event Ids 17055 and 19011."
- Previous message: Sophie Guo [MSFT]: "RE: Event Viewer won't display events"
- In reply to: Earl Newcomer: "Inconsistent negative numerical values in SQL2K database table"
- Next in thread: Earl Newcomer: "Re: Inconsistent negative numerical values in SQL2K database table"
- Reply: Earl Newcomer: "Re: Inconsistent negative numerical values in SQL2K database table"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 03 Feb 2005 01:14:14 -0500
Earl,
There are probably some values for which the sign byte of the
decimal value is something other than 01 or 00. See the explanation
here:
http://groups.google.co.uk/groups?q=218AE3EB-60D7-4E5E-A2F1
You should be able to find the values with the funky sign and fix them
as shown in the above thread like this:
update T set
decVal = 1*decVal
where [if a large table, identify just the ones that have bad signs if
possible]
or something similar if the values should be negative. A handful of
data providers seem to cause this problem, but I don't recall seeing it
between SQL Servers before. How did you move the data from
one to the other?
Steve Kass
Drew University
Earl Newcomer wrote:
>I have a case where the sum of a column containing positive, zero and
>negative values is correct in Query Analyzer but the values in the column do
>not contain a '-' (minus sign). The rows sort as expected but they do not
>have a minus sign. I can update a positive row value by multiplying it by -1
>and that value shows with a minus sign. The newly updated row sorts with the
>other negative values but it is the only row with a minus sign.
>
>This "condition" came to light when a cube built on the fact table (where
>this is occurring) was not summing correctly. The cube sees all values as
>positive as if an absolute function was being used. When the one positive
>row was updated to a negative value as described above, the cube recognized
>the negative value and the measure changed accordingly. What is it in the
>SQL Server table or in the cube interpretation of the table values that is
>causing this? Is there a workaround?
>
>Another twist. The table, pmix_fact1, with which we see this behavior was
>copied from another SQL Server 2000 server. The cubes built on that table
>sum correctly. I suspect the process of copying the table may be introducing
>this behavior. Has anyone experienced anything like this?
>
>I have seen this once before when using an ODBC driver to copy table rows
>from an Oracle 7.3.4 database to SQL Server 2000 where the values were all
>positive after the copy. I changed to the latest Oracle driver (9.0.1) that
>would still work with Oracle 7.3.4 and this resolved that problem. I have
>not seen a case where a SQL Server to SQL Server copy would confuse numeric
>values.
>
>Sample data from SQL Server 2000 SP3 Query Analyzer
>Extended_amount (sorted descending) No minus sign at the bottom.
>8.99
>7.99
>4.08
>3.19
>2.99
>2.98
>2.59
>2.29
>2.19
>2.19
>1.99
>1.79
>1.59
>1.49
>.69
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>2.29
>2.98
>2.98
>3.19
>4.08
>4.08
>------
>27.43
>
>The cube reports: 66.63
>
>Update the 8.99 to 8.99 * -1 and the Query Analyzer results are:
>Extended_amount
>7.99
>4.08
>3.19
>2.99
>2.98
>2.59
>2.29
>2.19
>2.19
>1.99
>1.79
>1.59
>1.49
>.69
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>.00
>2.29
>2.98
>2.98
>3.19
>4.08
>4.08
>-8.99
>------
>9.45
>
>The cube reports: 48.65
>
>Suggestions are appreciated.
>
>Earl Newcomer
>
>
>
>
>
- Next message: William Wang[MSFT]: "RE: Errors: Event Ids 17055 and 19011."
- Previous message: Sophie Guo [MSFT]: "RE: Event Viewer won't display events"
- In reply to: Earl Newcomer: "Inconsistent negative numerical values in SQL2K database table"
- Next in thread: Earl Newcomer: "Re: Inconsistent negative numerical values in SQL2K database table"
- Reply: Earl Newcomer: "Re: Inconsistent negative numerical values in SQL2K database table"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|