MinDbCompatibilityLevel (geography Data Type)
Returns the minimum database compatibility that recognizes the geography data type.
Składnia
. MinDbCompatibilityLevel ( )
Return Types
SQL Server return type: int
CLR return type: int
Uwagi
Use MinDbCompatibilityLevel() to test a spatial object for compatibility before changing the compatibility level on a database. An invalid geography type returns 110.
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(-120.533 46.566, -118.283 46.1, -122.3 47.45)';
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(-120.533 46.566, -118.283 46.1, -122.3 47.45)';
IF @g.MinDbCompatibilityLevel() <= 100
BEGIN
SELECT @g.ToString();
END
C. Testing the value of a Geography instance for compatibility
The following example shows the compatibility levels for two geography instances. One is smaller than a hemisphere and the other is larger than a hemisphere:
DECLARE @g geography = geography::Parse('POLYGON((0 -10, 120 -10, 240 -10, 0 -10))');
DECLARE @h geography = geography::Parse('POLYGON((0 10, 120 10, 240 10, 0 10))');
IF (@g.EnvelopeAngle() >= 90)
BEGIN
SELECT @g.MinDbCompatibilityLevel();
END
IF (@h.EnvelopeAngle() < 90)
BEGIN
SELECT @h.MinDbCompatibilityLevel();
END
The first SELECT statement returns 110 and the second SELECT statement returns 100.
Zobacz także
Odwołanie
ALTER DATABASE Compatibility Level (Transact-SQL)