Skip to content

Latest commit

 

History

History
65 lines (49 loc) · 1.87 KB

stdimension-geography-data-type.md

File metadata and controls

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

STDimension (geography Data Type)

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

Returns the maximum dimension of a geography instance.

Syntax

  
.STDimension ( )  

Return Types

[!INCLUDEssNoVersion] return type: int

CLR return type: SqlInt32

Remarks

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

Examples

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 geographyinstance.

name dim
Point 0
LineString 1
Polygon 2

See Also

OGC Methods on Geography Instances