Export (0) Print
Expand All

InstanceOf (geography Data Type)

A method that tests if the geography instance is the same as the specified type. 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.


.InstanceOf (geography_type )

geography_type

Is an nvarchar(4000) string specifying one of 12 types exposed in the geography type hierarchy.

SQL Server return type: bit

CLR return type: SqlBoolean

The input for the method must be one of the following: Geometry, Point, Curve, LineString, Surface, Polygon, GeometryCollection, MultiSurface, MultiPolygon, MultiCurve, MultiLineString, and MultiPoint.

This method throws an ArgumentException if any other strings are used for the input.

The following example creates a MultiPoint instance and uses InstanceOf() to see if 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');

Community Additions

ADD
Show:
© 2014 Microsoft