sql server - Update Geography column in table -
i have following table
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
Post a Comment