geometry.STIsEmpty
spatial predicate STIsEmpty
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
.STIsEmpty ( )
Work example
Use geometry.STIsEmpty to check whether a spatial value contains no points.
Use SQL IS NULL for a missing value and this method for an empty instance. Keep the geometry type and SRID in the review.
Check your work The empty collection returns STIsEmpty=1 and IsNull=0. Empty is not NULL.
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'GEOMETRYCOLLECTION EMPTY', 0);
SELECT @shape.STIsEmpty() AS is_empty, @shape.IsNull AS is_null,
@shape.STSrid AS source_srid,
@shape.STIsValid() AS source_is_valid;
Open Microsoft Learn for full syntax, permissions, and details for your version.