geometry.IsNull
spatial predicate IsNull
What changes
- Input
- one or two spatial instances
- Output or change
- bit
- Return type
- SQL Server type: bit CLR type: SqlBoolean
Syntax at a glance
.IsNull
Work example
Use geometry.IsNull to inspect a null spatial instance in a diagnostic result.
Use SQL IS NULL for normal predicates and check empty shapes separately. Keep the geometry type and SRID in the review.
Check your work NULL has IsNull=1. The empty collection has IsNull=0 and STIsEmpty=1.
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 @missing geometry;
SET @missing = geometry::[Null];
DECLARE @empty geometry;
SET @empty = geometry::STGeomFromText(N'GEOMETRYCOLLECTION EMPTY', 0);
SELECT @missing.IsNull AS missing_is_null,
@missing.STIsEmpty() AS missing_is_empty,
@empty.IsNull AS empty_is_null,
@empty.STIsEmpty() AS empty_is_empty;
Open Microsoft Learn for full syntax, permissions, and details for your version.