Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
STDimension (geometry Data Type)
Collapse the table of content
Expand the table of content

STDimension (geometry Data Type)

 

Applies To: SQL Server 2014, SQL Server 2016 Preview

Returns the maximum dimension of a geometry instance.

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.


.STDimension ( )

SQL Server return type: int

CLR return type: SqlInt32

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

The following example creates a table variable to hold geometry instances and inserts a Point, a LineString, and a Polygon. It then uses STDimension() to return the dimensions of each geometry instance.

DECLARE @temp table ([name] varchar(10), [geom] geometry);
INSERT INTO @temp values ('Point', geometry::STGeomFromText('POINT(3 3)', 0));
INSERT INTO @temp values ('LineString', geometry::STGeomFromText('LINESTRING(0 0, 3 3)', 0));
INSERT INTO @temp values ('Polygon', geometry::STGeomFromText('POLYGON((0 0, 3 0, 0 3, 0 0))', 0));
SELECT [name], [geom].STDimension() as [dim]
FROM @temp;

The example then returns the dimensions of each geometry instance.

name

dim

Point

0

LineString

1

Polygon

2

Community Additions

ADD
Show:
© 2015 Microsoft