SQL Flow Field Guide

geography.STIsValid

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

spatial predicate STIsValid

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

.STIsValid ( )

Work example

Use geography.STIsValid to check whether a shape meets spatial validity rules.

Validate imported polygons before area and overlay calculations. Keep the geography type and SRID in the review.

Check your work The closed, non-self-intersecting sample polygon returns 1 for valid.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

SELECT p.shape.STIsValid() AS polygon_is_valid FROM (VALUES (geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326))) AS p(shape);

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