May 22, 2012 at 1:08 pm
Comments posted to this topic are about the item Calculate Distance Between Two Points
June 11, 2012 at 10:07 pm
You could also use the STDistance function on 2 geo columns/objects?
June 12, 2012 at 8:37 am
I noticed you were using and passing floats rather than the new spacial data types introduce in SQL Server 2008. Any reason why?
June 15, 2012 at 2:27 am
Very nice script but it's not stable.
Check the following examples:
1. select dbo.MyDistance(46.192131,21.274666,46.192131,21.274665)
2. select dbo.MyDistance(46.192131,21.274666,46.192131,21.274666)
Both examples will give the following error:
Msg 3623, Level 16, State 1, Line 1
An invalid floating point operation occurred.
Keep improving it!
July 5, 2012 at 2:21 am
MSzI (6/15/2012)
Very nice script but it's not stable.Check the following examples:
1.
select dbo.MyDistance(46.192131,21.274666,46.192131,21.274665)
2.
select dbo.MyDistance(46.192131,21.274666,46.192131,21.274666)
Both examples will give the following error:
Msg 3623, Level 16, State 1, Line 1
An invalid floating point operation occurred.
Keep improving it!
I run both your query,here is no issue.see the attached..as the difference is too small so 0 is ans...if i cange your query to select dbo.Distance(46.192131,21.274666,46.292131,21.374666) then you can see distance.see the attached
July 5, 2012 at 2:44 am
krowley (6/12/2012)
I noticed you were using and passing floats rather than the new spacial data types introduce in SQL Server 2008. Any reason why?
it was for SQL Server2005.i have a small application from where a user can click on two different locations and this function return distance....as from google map we get Lat,Lon.that is why i have used this data type...
July 9, 2012 at 10:17 am
Makes sense if this was a SQL 2005 project. We still have a lot of stuff running on SQL 2005 as well.
May 10, 2016 at 9:29 am
Thanks for the script.
May 10, 2016 at 9:29 am
I should have had this in college.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply