MinDbCompatibilityLevel (geometry Data Type)

 

Returns the minimum database compatibility level that recognizes the geometry data type instance.

Applies to: SQL Server (SQL Server 2012 through current version), Azure SQL Database.
  
.MinDbCompatibilityLevel ( )  

SQL Server return type: int

CLR return type: int

Use MinDbCompatibilityLevel() to test a spatial object for compatibility before changing the compatibility level on a database.

A. Testing CircularString type for compatibility with compatibility level 110

The following example tests a CircularString instance for compatibility with an earlier version of SQL Server:

DECLARE @g geometry = 'CIRCULARSTRING(3 4, 8 9, 5 6)';

IF @g.MinDbCompatibilityLevel() <= 110

BEGIN

SELECT @g.ToString();

END

B. Testing LineString type for compatibility with compatibility level 100

The following example tests a LineString instance for compatibility with SQL Server 2008:

DECLARE @g geometry = 'LINESTRING(3 4, 8 9, 5 6)';

IF @g.MinDbCompatibilityLevel() <= 100

BEGIN

SELECT @g.ToString();

END

ALTER DATABASE Compatibility Level (Transact-SQL)

Community Additions

ADD
Show: