geometry.STPointN
spatial method STPointN (instance.STPointN(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- geometry
- Return type
- SQL Server return type: geometry CLR return type: SqlGeometry Open Geospatial Consortium (OGC) type: Point
Syntax at a glance
.STPointN ( expression )
Work example
Use geometry.STPointN to read one point from a line or supported curve.
Use a one-based position and validate the input point count. Keep the geometry type and SRID in the review.
Check your work STPointN is one-based. The second stored vertex is POINT (3 4).
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
-- Planar geometry. SRID 0 coordinates here are synthetic units, not metres.
DECLARE @shape geometry;
SET @shape = geometry::STGeomFromText(N'LINESTRING(0 0, 3 4)', 0);
SELECT @shape.STPointN(2).STAsText() AS second_vertex,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.