SQL Flow Field Guide

geometry.MinDbCompatibilityLevel

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

spatial method MinDbCompatibilityLevel (instance.MinDbCompatibilityLevel(...))

What changes

Input
spatial instance (and arguments)
Output or change
int
Return type
SQL Server return type: int CLR return type: int

Syntax at a glance

.MinDbCompatibilityLevel ( )

Work example

Use geometry.MinDbCompatibilityLevel to check the minimum compatibility level for an extended method.

Compare with the target database before shared code uses the method. Keep the geometry type and SRID in the review.

Check your work The method reports the minimum database compatibility level required for this instance.

Practice SQL

Open in SQL Flow

Open 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'POINT(3 4)', 0);
SELECT @shape.MinDbCompatibilityLevel() AS minimum_compatibility_level,
       @shape.STSrid AS source_srid,
       @shape.STIsValid() AS source_is_valid;

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