SQL Flow Field Guide

geography.STPointN

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

spatial method STPointN (instance.STPointN(...))

What changes

Input
spatial instance (and arguments)
Output or change
geography
Return type
SQL Server return type: geography CLR return type: SqlGeography Open Geospatial Consortium (OGC) type: Point

Syntax at a glance

.STPointN ( expression )

Work example

Use geography.STPointN to read one point from a line or supported curve.

Use a one-based position and validate the input point count. Keep the geography type and SRID in the review.

Check your work STPointN uses a one-based index; point 2 is longitude -122.343 and latitude 47.656.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

SELECT r.shape.STPointN(2).STAsText() AS second_vertex_wkt FROM (VALUES (geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326))) AS r(shape);

Open Microsoft Learn for full syntax, permissions, and details for your version.