Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.21 KB

instanceof-geography-data-type.md

File metadata and controls

65 lines (48 loc) · 2.21 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom f1_keywords helpviewer_keywords dev_langs monikerRange
InstanceOf (geography Data Type)
InstanceOf (geography Data Type)
MladjoA
mlandzic
03/14/2017
sql
t-sql
reference
ignite-2024
InstanceOf
InstanceOf_TSQL
InstanceOf method
TSQL
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric

InstanceOf (geography Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]

Tests if the geography instance is the same as the specified type.

Syntax

  
.InstanceOf ( 'geography_type')  

Arguments

geography_type
The nvarchar(4000) string specifying one of 16 types exposed in the geography type hierarchy.

Return Types

[!INCLUDEssNoVersion] return type: bit

CLR return type: SqlBoolean

Remarks

Returns 1 if the type of a geography instance is the same as the specified type, or if the specified type is an ancestor of the instance type; otherwise, returns 0.

This geography data type method supports FullGlobe instances or spatial instances that are larger than a hemisphere.

The input for the method must be one of these types: Geometry, Point, Curve, LineString, CircularString, Surface, Polygon, CurvePolygon, GeometryCollection, MultiSurface, MultiPolygon, MultiCurve, MultiLineString, MultiPoint, or FullGlobe.

This method throws an ArgumentException if you use any other strings for the input.

This method isn't precise.

Examples

The following example creates a MultiPoint instance and uses InstanceOf() to see whether the instance is a GeometryCollection.

DECLARE @g geography;  
SET @g = geography::STGeomFromText('MULTIPOINT(-122.360 47.656, -122.343 47.656)', 4326);  
SELECT @g.InstanceOf('GEOMETRYCOLLECTION');  

See Also

Extended Methods on Geography Instances