sql server - Check for geolocation already in my Database -


i mobile current geolocation (long./lat.) , store geolocation online in sql server 2008 database. how can check not have location (maybe in radius of 100 meter)?

the easiest way can think of not exists (location within 100 meters.)

here sample implementation this:

--a table coordinates. create table #myexistinglocations (id int identity(1,1) primary key clustered not null ,location geography not null ,shortdescription varchar(30) null ) insert #myexistinglocations values(geography::point(40.750508,-73.993735,4326),'madison square garden') ,(geography::point(40.705524,-74.01351,4326),'charging bull') ;  mynewlocations(l,sd) --represents new stuff want put in. ( select geography::point(40.70585,-74.013486,4326),'wall street bull!' union select geography::point(40.713728,-73.990173,4326),'east broadway!' ) select * mynewlocations not exists (select 1 #myexistinglocations b b.location.stdistance ( a.l ) <= 100) 

the last row essential question. "east broadway!" returned since "wall street bull!" close existing location.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -