geometry.STBoundary
spatial method STBoundary (instance.STBoundary(...))
What changes
- Input
- spatial instance (and arguments)
- Output or change
- geometry
- Return type
- SQL Server return type: geometry CLR return type: SqlGeometry
Syntax at a glance
.STBoundary ( )
Work example
Use geometry.STBoundary to return the boundary of a supported shape.
Check the instance type because points, curves, and surfaces have different boundaries. Keep the geometry type and SRID in the review.
Check your work The boundary is the square's closed LineString in planar coordinate units.
Practice SQL
Open in SQL FlowOpen 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'POLYGON((0 0, 4 0, 4 4, 0 4, 0 0))', 0);
SELECT @shape.STBoundary().STAsText() AS polygon_boundary,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.