geography.NumRings
spatial method NumRings (instance.NumRings(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- int
- Return type
- SQL Server return type: int CLR return type: SqlInt32
Syntax at a glance
.NumRings ()
Work example
Use geography.NumRings to count rings in a geography polygon.
Check the shape type and include interior rings in the interpretation. Keep the geography type and SRID in the review.
Check your work The polygon has two rings, its exterior ring and its interior ring.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT p.shape.NumRings() AS ring_count 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), (-122.357 47.654, -122.357 47.657, -122.349 47.657, -122.349 47.650, -122.357 47.654))', 4326))) AS p(shape);
Open Microsoft Learn for full syntax, permissions, and details for your version.