>Some things come to mind
>
>(1) They may also store the lattitude in radians to speed up the calculation
>(2) They may have a table that stores all the distances (and update it within a trigger if the coordinates of a city are changed/added)
>eg 10,000 cities would be a table of 10,000 * 10,000 / 2 records = 50,000,000 records
I am looking at this right now:
http://msdn.microsoft.com/en-us/library/ms980211.aspxAs for point 2, in order to know a distance, we need two set of coordinates. So, this can only be known when the user do the search. So, basically, calculation applies at search time only. In the page I have added here, there is a SQL Server code to do this so I am trying it now. But, the more records there is, the more time it will take.