MinDbCompatibilityLevel (geometry Data Type)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
Returns the minimum database compatibility level that recognizes the geometry data type instance.
Syntax
.MinDbCompatibilityLevel ( )
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Return Types
SQL Server return type: int
CLR return type: int
Remarks
Use MinDbCompatibilityLevel()
to test a spatial object for compatibility before changing the compatibility level on a database.
Examples
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 (10.0.x):
DECLARE @g geometry = 'LINESTRING(3 4, 8 9, 5 6)';
IF @g.MinDbCompatibilityLevel() <= 100
BEGIN
SELECT @g.ToString();
END
See Also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for