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
 Other SQL Server Topics (2005)
 Quirky Overflow Error - Stumped

Author  Topic 

arandall
Starting Member

2 Posts

Posted - 2009-07-09 : 16:05:58
I'm getting the following error at times.

"arithmetic overflow error converting expression to data type float"

Now the SQL Statement I am running is:-
SELECT @x = Cos(@lat1) * Cos(@lat2) * Cos(@long1 - @long2) + Sin(@lat1) * Sin(@lat2)

The data is:-
SELECT @x = Cos(0.585524802788309) * Cos(0.587051965883804) * Cos(1.47653458455319 - 1.47164242665985) + Sin(0.585524802788309) * Sin(0.587051965883804)

I will work every time I run it manually in SQL. The proc that is running is part of another proc, and we run it 50 or so times in a few seconds. It will randomly fail one or two times for the 50 of so sets of data put in. I don't think its the data or even the proc, so my guess is something in the setup of SQL somewhere that is choking when it hits some kind of data limit.

I know I am grasping at straws, but any ideas?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-09 : 16:21:15
The error message also prints the line producing the error.
Does the above code correspond to the error line?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

arandall
Starting Member

2 Posts

Posted - 2009-07-09 : 16:28:53
Yes it does, and it returns a NULL. But I run 50 data sets at a time, and its random on what one it fails on, and also the same data set a second time will fail with a different set of data, hence it cannot be data.
Go to Top of Page
   

- Advertisement -