>In all honesty - you may need that
>
>When I was taking my walk yesterday I figured out the use of the first clause
>
>If you do not have that many records, it does not matter, but with a lot of records there will be a difference in speed
>
>The first clause restricts the set to those that are in a square around you (latitude between .. and ... and longitude between .. and ...)
>
>The second one calculates the radius of the points in the square
This is to be executed against 3000 to 4000 records. And, this is temporary. There is a good chance that by the time this goes in production, that we will be using spatial data type as we will have SQL Server 2008. So, this will look like this:
DECLARE @GeographyCoordinate Geography
DECLARE @Area Geography
SET @GeographyCoordinate=Geography::Point(47.7795,-65.7191,4326)
SET @Area=@GeographyCoordinate.STBuffer(50*1000)
SELECT Client.Numero,@GeographyCoordinate.STDistance(GeographyPoint)/1000 AS Distance
FROM (SELECT *,Geography::Point(Latitude,Longitude,4326) AS GeographyPoint FROM Client) Client
WHERE @Area.STIntersects(Client.GeographyPoint)=1
From what I read, this is meters by default.