Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Arithmetic Overflow

Author  Topic 

richjamison
Starting Member

5 Posts

Posted - 2010-12-17 : 13:12:27
Trying to return results from a SELECT query, and getting error:

"An error occurred while executing batch. Error message is: Arithmetic Overflow."

The query is as follows:

SELECT
collumn1,
collumn2
FROM table
WHERE collumn1 BETWEEN '2010-12-06 00:00:00' AND '2010-12-15 00:00:00'
ORDER BY collumn1 DESC


collumn1 is smalldatetime
collumn2 is real; containing values like 0, -1.725883E+24, 128505.2, -4.875831E-27, etc.

The query does return a little over 7000 results before the error occurs. But there should be ore like 94,000 results.

I believe I have narrowed the problem to a value whithin collumn2 ,but am unable to pin point the source. Any ideas on how I might further drill down to the problem?

Thanks,

Rich

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-12-17 : 13:19:25
You aren't casting, or performing math against column1?

Anyway, you're right, it's a value in column1. Just need to find it -- unless, as I said, you're casting it or performing math against it. In that case you need to modify the query.
Go to Top of Page

richjamison
Starting Member

5 Posts

Posted - 2010-12-17 : 13:28:42
no casting going on. i did try some casting early on, but that was not helping so i reverted back to the original query.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-17 : 14:02:54
Try:
WHERE collumn1 BETWEEN '2010-12-06T00:00:00' AND '2010-12-15T00:00:00'
or simple:
WHERE collumn1 BETWEEN '20101206' AND '20101215'




No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

richjamison
Starting Member

5 Posts

Posted - 2010-12-17 : 14:18:46
no dice webfred. tried both ways.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-17 : 14:24:39
Sounds like a SQL bug. What does SELECT @@VERSION show?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

richjamison
Starting Member

5 Posts

Posted - 2010-12-17 : 15:32:34
turns out, i am posting this in the wrong forum. the version shows: Microsoft SQL Server 2000 - 8.00.2055 (Intel X86) Dec 16 2008 19:46:53 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)

and before anyone says so, i know its old and unsupported. but i have no control over whether or not it gets upgraded.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-12-17 : 15:52:14
Can you try just:
SELECT collumn2 FROM table
and see if it errors?

If you are not doing any manipulation on that column and it is erroring just trying to return data, then I can only guess the database is corrupted.

Just to verify the ACTUAL datatype on Column1 and Column2 are SMALLDATETIME and FLOAT?
Go to Top of Page

richjamison
Starting Member

5 Posts

Posted - 2010-12-17 : 15:58:33
we found it to be a single record that had corupt value. we fixed the value, and now it works like a charm.
Go to Top of Page
   

- Advertisement -