Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.24 KB

stpointn-geometry-data-type.md

File metadata and controls

65 lines (48 loc) · 2.24 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom f1_keywords helpviewer_keywords dev_langs monikerRange
STPointN (geometry Data Type)
STPointN (geometry Data Type)
MladjoA
mlandzic
08/03/2017
sql
t-sql
reference
ignite-2024
STPointN_TSQL
STPointN (geometry Data Type)
STPointN (geometry Data Type)
TSQL
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric

STPointN (geometry Data Type)

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

Returns a specified point in a geometry instance.

Syntax

  
.STPointN ( expression )  

Arguments

expression
Is an int expression between 1 and the number of points in the geometry instance.

Return Types

[!INCLUDEssNoVersion] return type: geometry

CLR return type: SqlGeometry

Open Geospatial Consortium (OGC) type: Point

Remarks

If a geometry instance is user created, STPointN() returns the point specified by expression by ordering the points in the order in which they were originally input.

If a geometry instance was constructed by the system, STPointN() returns the point specified by expression by ordering all the points in the same order they would be output: first by geometry, then by ring within the geometry (if appropriate), and then by point within the ring. This order is deterministic.

If this method is called with a value less than 1, it throws an ArgumentOutOfRangeException.

If this method is called with a value greater than the number of points in the instance, it returns null.

Examples

The following example creates a LineString instance and uses STPointN() to retrieve the second point in the description of the instance.

DECLARE @g geometry;  
SET @g = geometry::STGeomFromText('LINESTRING(0 0, 2 2, 1 0)', 0);  
SELECT @g.STPointN(2).ToString();  

See Also

OGC Methods on Geometry Instances