Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enter data in geography column in SQL Server management studio

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?

like image 631
ml123 Avatar asked Dec 24 '12 18:12

ml123


People also ask

What is geography data type in SQL Server?

The geography spatial data type, geography, is implemented as a . NET common language runtime (CLR) data type in SQL Server. This type represents data in a round-earth coordinate system. The SQL Server geography data type stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates.

How do I add data to SQL Server Management Studio?

To quickly generate an insert statement in SQL Server Management Studio for a table that already exists, right click the table, navigate to Script Table as > INSERT To > New Query Editor Window.


2 Answers

If editing a table cell a la mano just type in

POINT (2.434548 48.858319 4326) 
like image 142
Antoine Meltzheim Avatar answered Nov 02 '22 02:11

Antoine Meltzheim


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.

like image 37
Bernhard Barker Avatar answered Nov 02 '22 04:11

Bernhard Barker