SQL Flow Field Guide

geography.STEndpoint

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

spatial method STEndpoint (instance.STEndpoint(...))

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

.STEndPoint ( )

Work example

Use geography.STEndpoint to read the final point of a line.

Check the instance type and handle an empty line. Keep the geography type and SRID in the review.

Check your work The returned point is the route's last coordinate, 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.STEndPoint().STAsText() AS route_end_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.