SQL Flow Field Guide

geography.STGeometryN

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

spatial method STGeometryN (instance.STGeometryN(...))

What changes

Input
spatial instance (and arguments)
Output or change
geography
Return type
SQL Server return type: geography CLR return type: SqlGeography

Syntax at a glance

.STGeometryN ( expression )

Work example

Use geography.STGeometryN to read one member from a spatial collection.

Use a one-based index and retain a relational key when member identity matters. Keep the geography type and SRID in the review.

Check your work STGeometryN uses a one-based index; component 2 is the point at 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 m.shape.STGeometryN(2).STAsText() AS second_component_wkt FROM (VALUES (geography::STGeomFromText('MULTIPOINT(-122.360 47.656, -122.343 47.656)', 4326))) AS m(shape);

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