sql server - Update Geography column in table -


i have following table

enter image description here

as can geo column (data type geography) null have 11913 rows in table i'm trying update geo column using following statement , populate geo column data provided geography::stgeomfromtext

declare @temp table ( id bigint, latitude decimal(9,6), longitude decimal(9,6) )  insert @temp (id, latitude, longitude)     select id, latitude, longitude location.cities  active = 1  update location.cities set geo = geography::stgeomfromtext (point(select latitude, longitude  @temp), 4326) id = -- massively confused..... 

two issues have come against select latitude, longitude @temp says point not recognized built-in function name , other how can make sure update right record/row i've selected latitude , longitude from.

the reason need because on our application allowing end user search radius.

any great.

you don't need temp table @temp. can use geography::point directly on table location.cities.

something this.

update location.cities set geo = geography::point(latitude, longitude , 4326) 

if want use geography::stgeomfromtext, can use this.

    update location.cities         set geo = geography::stgeomfromtext('point(' + convert(varchar(30),longitude ) + ' ' + convert(varchar(30),latitude) + )',4326) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -