Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Equivalent of atn function
Message
De
13/04/2010 13:15:06
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01459871
Message ID:
01459976
Vues:
35
>
>CREATE FUNCTION [dbo].[CalculateDistance]
>    (@Longitude1 DECIMAL(8,5), 
>    @Latitude1   DECIMAL(8,5),
>    @Longitude2  DECIMAL(8,5),
>    @Latitude2   DECIMAL(8,5))
>RETURNS FLOAT
>AS
>BEGIN
>DECLARE @Temp FLOAT
> 
>SET @Temp = SIN(@Latitude1/57.2957795130823) * SIN(@Latitude2/57.2957795130823) +
> COS(@Latitude1/57.2957795130823) * COS(@Latitude2/57.2957795130823) * COS(@Longitude2/57.2957795130823 - @Longitude1/57.2957795130823)
> 
>IF @Temp > 1 
>    SET @Temp = 1
>ELSE IF @Temp < -1
>    SET @Temp = -1
> 
>RETURN (3958.75586574 * ACOS(@Temp) ) 
> 
>END
I already have the method to calculate the distance between two coordinates. I am trying to find the proper SQL command to return the records matching a certain distance from a set of coordinates.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform