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)
 Domain Error Occurred

Author  Topic 

sduffy77
Starting Member

18 Posts

Posted - 2009-03-09 : 12:52:58
Ok, so I found an instance where I'm getting the "Domain Error Occurred" in our search sproc.

It is happened when we calculate distance for one particular zip code.

Here's a snippet:



DECLARE @Zip varchar(5)

DECLARE @ZIP2 VARCHAR(5)

SET @Zip = '22182'
--Zip Latitude Longitude
--22182 38.93529 -77.26802

SET @Zip2 = '22182'

SELECT *
,3958.75 * ( Atan(Sqrt(1 - power(((Sin(searchzip.[Latitude]/57.2958) * Sin(vehzip.[Latitude]/57.2958)) +
(Cos(searchzip.[Latitude]/57.2958) * Cos(vehzip.[Latitude]/57.2958) * Cos((vehzip.[Longitude]/57.2958) - (searchzip.[Longitude]/57.2958)))), 2)) /
((Sin(searchzip.[Latitude]/57.2958) * Sin(vehzip.[Latitude]/57.2958)) + (Cos(searchzip.[Latitude]/57.2958) * Cos(vehzip.[Latitude]/57.2958) *
Cos((vehzip.[Longitude]/57.2958) - (searchzip.[Longitude]/57.2958)))))) AS [DistanceInMiles]
FROM dbo.[ZIP_CODES] searchzip
INNER JOIN dbo.[ZIP_CODES] vehzip
ON vehzip.ZIp = @Zip2 AND vehzip.[Zip_Class] = 'STANDARD'
WHERE searchzip.zip = @Zip AND searchzip.[Zip_Class] = 'STANDARD'


This doesn't seem to be occurring for any other zipcodes, does anyone have any idea why?
   

- Advertisement -