Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
 STDimension (geography Data Type)
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
SQL Server 2008 Books Online (October 2009)
STDimension (geography Data Type)

Returns the maximum dimension of a geography instance.

.STDimension ( )

SQL Server return type: int

CLR return type: SqlInt32

STDimension() returns -1 if the geography instance is empty.

The following example uses STDimension() to create a table variable to hold geography instances, and inserts a Point, a LineString, and a Polygon.

DECLARE @temp table ([name] varchar(10), [geom] geography);

INSERT INTO @temp values ('Point', geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326));
INSERT INTO @temp values ('LineString', geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326));
INSERT INTO @temp values ('Polygon', geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326));

SELECT [name], [geom].STDimension() as [dim]
FROM @temp;

The example then returns the dimensions of each geography instance.

name dim

Point

0

LineString

1

Polygon

2

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker