14

I've created a new table in SQL Server Management Studio, which includes a Geography column. Now, I'm trying to enter data in this column using the SSMS UI, but I just can't find the right way of doing it.

So, how can that be done?

Litisqe Kumar
  • 2,512
  • 4
  • 26
  • 40
ml123
  • 1,059
  • 2
  • 12
  • 27

2 Answers2

32

I wouldn't think SSMS natively supports doing this with a nice interface (e.g. a map). Maybe there's some add-on to allow this, or likely some 3rd party app.

If you're happy with doing it in SQL, try this:

UPDATE tableName SET geographyColumn = geography::Point(47.65100, -122.34900, 4326)

Derived from here.

Here are 4 more ways to do the same.

Colin Mackay
  • 18,736
  • 7
  • 61
  • 88
Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
  • 3
    I understand the first 2 parameter in the Point() method are the lat/long and the 3rd is the SRID. However; what does the value 4326 represent? I can not find any info anywhere which indicates what I should specify. – Andy Clark Nov 19 '15 at 10:43
  • 1
    @AndyClark This query should answer your question. select * from sys.spatial_reference_systems where spatial_reference_id = 4326 – Jason Watts Jan 18 '16 at 16:39
  • Is 4326 belong to special know system, since I've seen it in many examples around the web? – VSB Oct 23 '17 at 14:12
  • It represents WGS 84 - https://en.wikipedia.org/wiki/World_Geodetic_System – Sean Sherman Feb 26 '18 at 22:17
7

If editing a table cell a la mano just type in

POINT (2.434548 48.858319 4326) 
Antoine Meltzheim
  • 9,579
  • 6
  • 35
  • 41