Determine Distance Between Any Two Locations

 Author Message kgayda Ten Centuries Group: General Forum Members Points: 1017 Visits: 172 Comments posted to this topic are about the item Determine Distance Between Any Two Locations Karen GaydaMCP, MCSD, MCDBAgaydaware.com hypo Forum Newbie Group: General Forum Members Points: 1 Visits: 4 Thanks alot for the clean and good function!!Kind regards,Wim jgao Forum Newbie Group: General Forum Members Points: 1 Visits: 4 There is one issue in the CalcDistanceBetweenGeoLocations function. Sometime you will get an error, "A domain error occurred.", by passing in some specific parameters.So I added the following Code: --reset @Distance if it is out of the range of (-1,1) If @Distance>1 set @Distance=1 If @Distance<-1 set @Distance=-1before --Get distance in miles SET @Distance = (DEGREES(ACOS(@Distance))) * 69.09Because ACOS can be only with a value from -1 through 1. kgayda Ten Centuries Group: General Forum Members Points: 1017 Visits: 172 jgao,Thanks for pointing that out. Karen GaydaMCP, MCSD, MCDBAgaydaware.com