SQL Flow Field Guide

geometry.STIsRing

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

spatial predicate STIsRing

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

.STIsRing ( )

Work example

Use geometry.STIsRing to check whether a closed curve is a simple ring.

Validate lines and review self-intersections separately. Keep the geometry type and SRID in the review.

Check your work The closed, simple triangle line is a ring.

Practice SQL

Open in SQL Flow

Open 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, 4 0, 4 3, 0 0)', 0);
SELECT @shape.STIsRing() AS is_ring, @shape.STIsClosed() AS is_closed, @shape.STIsSimple() AS is_simple,
       @shape.STSrid AS source_srid,
       @shape.STIsValid() AS source_is_valid;

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