== Spatial Data Types==

These data types are actual CLR classes and require SQLCLR code instead of T-SQL. Properties defined by CLR datatypes, such as ToString(), STArea(), or STIntersects(), are case-sensitive.

To create an item of geography or geometry data, you must use a static method belonging to the appropriate datatype as shown below. (Including several other operations)

SELECT geometry::Parse('POINT(30 40)');

CREATE TABLE geographypoints (
Location geography
);

INSERT INTO geographypoints VALUES
(geography::Point(51, 1, 4326)),
(geography::Point(52, –2, 4326)),
(geography::Point(50.7, –1.1, 4326));

SELECT Location.ToString()
FROM geographypoints;

DECLARE @point geometry = geometry::Point(12, 7, 0);
SELECT @point.STBuffer(5);

DECLARE @point geometry = geometry::Point(3, 5, 0);
SELECT @point.STBuffer(5).STArea();

SELECT Location.Lat, Location.Long
FROM geographypoints;

Changing the coordinate values associated with a geometry or geography instance requires you to create an entirely new geometry from a static method. However, certain properties of existing geometries can be both retrieved and set.

UPDATE geographypoints
SET Location.STSrid = 4269;

All of the functionality of the geography and geometry datatypes is contained in two libraries: Microsoft.SqlServer.Types.dll and SqlServerSpatial.dll