Monday 21 December 2020

Calculate distance between two latitude longitude points using SQL Server

 /////////// Sql query


DECLARE @Lat decimal(18,4) = 17.491716000
,@Long decimal(18,4) = 76.514721000
,@Lat_2 decimal(18,4) = 17.341667000
,@Long_2 decimal(18,4) = 76.596667000
, @Location decimal(18,4) 
 
SET @Location = SQRT(POWER(69.1 * ( @Lat_2 - @Lat),2) + POWER(69.1 * ( @Long - @Long_2)* COS(@Lat_2 / 57.3), 2)) 
select @Location


/////////// Result

11.6913


No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...