SQL Flow Field Guide

geography.STIsClosed

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

spatial predicate STIsClosed

What changes

Input
one or two spatial instances
Output or change
bit
Return type
SQL Server return type: bit CLR return type: SqlBoolean

Syntax at a glance

.STIsClosed ( )

Work example

Use geography.STIsClosed to check whether a curve start and end meet.

Check the instance type and distinguish closure from polygon validity. Keep the geography type and SRID in the review.

Check your work The first and last line points match, so the line is closed.

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.STIsClosed() AS route_is_closed FROM (VALUES (geography::STGeomFromText('LINESTRING(-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653)', 4326))) AS r(shape);

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