Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

InstanceOf (geometry Data Type)


Applies To: SQL Server 2014, SQL Server 2016 Preview

A method that tests if the geometry instance is the same as the specified type. Returns 1 if the type of a geometry instance is the same as the specified type, or if the specified type is an ancestor of the instance type; otherwise, returns 0.

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

.InstanceOf ( geometry_type )


Is an nvarchar(4000) string specifying one of 15 types exposed in the geometry 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, CircularString, CompoundCurve, Surface, Polygon, CurvePolygon, 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 geometry;
SET @g = geometry::STGeomFromText('MULTIPOINT(0 0, 13.5 2, 7 19)', 0);
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft