Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 1.81 KB

File metadata and controls

63 lines (49 loc) · 1.81 KB
title STDimension (geometry Data Type)
description STDimension (geometry Data Type)
author MladjoA
ms.author mlandzic
ms.date 08/03/2017
ms.service sql
ms.subservice t-sql
ms.topic reference
ms.custom
ignite-2024
f1_keywords
STDimension_TSQL
STDimension (geometry Data Type)
helpviewer_keywords
STDimension (geometry Data Type)
dev_langs
TSQL

STDimension (geometry Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]

Returns the maximum dimension of a geometry instance.

Syntax

  
.STDimension ( )  

Return Types

[!INCLUDEssNoVersion] return type: int

CLR return type: SqlInt32

Remarks

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

Examples

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

See Also

OGC Methods on Geometry Instances