11

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,240
  • 4
  • 23
  • 38
ml123
  • 907
  • 2
  • 9
  • 20

2 Answers2

27

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
  • 17,309
  • 4
  • 61
  • 83
Bernhard Barker
  • 50,899
  • 13
  • 85
  • 122
  • 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
5

If editing a table cell a la mano just type in

POINT (2.434548 48.858319 4326) 
Antoine Meltzheim
  • 8,525
  • 6
  • 31
  • 39