I have a table with a field that has a numeric data type (15,2) and length of 9. The problem is that it won't display the actual negative sign for any values less than 0 when running a query. Any ideas? I've used Query Analyzer as well as Access.
Thanks.Huh?
DECLARE @.x decimal(15,4)
set @.x = -12345.1234
SELECT @.x|||Maybe this will help.
For instance, one customer in the table has values like this:
4380.00
4380.00
8760.00
4380.00
4380.00
23360.00
23360.00
but actually it should be:
4380.00
-4380.00
8760.00
-4380.00
-4380.00
23360.00
-23360.00
which nets to a total of 0. And if I change the query to a group query and perform a sum on this revenue field I will get 0 but if I do a normal select I'll get all positives. Sql server knows that some of the revenue is negative it just doesn't display the - sign infront of it.
Btw:
DECLARE @.x decimal(15,4)
set @.x = -12345.1234
SELECT @.x
works correctly.|||How are you viewing the data? I betcha it's a front end issue?
Or are yu seeing this in QA.
Read the huint sticky at the top of the board and post what it asks for|||"select [Value] from [YourTable] where [Value] < 0" returns what?|||I've gotten the same results using Access as the front end linking the sql server table and using Query Analzyer. I will take a look at that sticky.
If I run the same query with the < 0 criteria I will get values returned that look positive. I even copied and pasted the values into Excel and they still show up as positive values.
If I change the data type to float it works fine, but for some reason numeric data type won't display negative values.|||are you sure you aren't running this:
select abs(mycol) from mytable where mycol < 0
in any case I can't repro it:
declare @.t table (col decimal(15,2))
insert into @.t
select -12.11 union all select 234.33 union all select -44.444
select * from @.t
col
------------
-12.11
234.33
-44.44|||Sorry etaktaf, but unless you can provide us with some code for replicating this problem (create table, populate table, select results...), then I don't think we can help you any further.|||In other words post some examplkes as the hint link states
Friday, March 9, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment