Skip to content

Instantly share code, notes, and snippets.

@brazilnut2000
Created August 23, 2013 21:27
Show Gist options
  • Save brazilnut2000/6324209 to your computer and use it in GitHub Desktop.
Save brazilnut2000/6324209 to your computer and use it in GitHub Desktop.
SQL: Populate GeoLocation table from Latitude and Longitude
/*
Assumes table has populated Latitude and Longitude columns
Populates the GeoLocation column from Lat ad Lon
*/
UPDATE [dbo].[TableX]
SET [GeoLocation] = geography::Parse('POINT(' + CAST([Longitude] AS VARCHAR(20)) + ' ' +
CAST([Latitude] AS VARCHAR(20)) + ')')
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment