Export (0) Print
Expand All
Expand Minimize

STGeometryN (geometry Data Type)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Returns a specified geometry in a geometry collection.

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

.STGeometryN ( expression )

expression

Is an int expression between 1 and the number of geometry instances in the geometry collection.

SQL Server return type: geometry

CLR return type: SqlGeometry

This method returns null if the parameter is larger than the result of STNumGeometries() and will throw an ArgumentOutOfRangeException if the expression parameter is less than 1.

The following example creates a MultiPoint geometry collection and uses STGeometryN() to find the second geometry instance of the collection.

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('MULTIPOINT(0 0, 13.5 2, 7 19)', 0);
SELECT @g.STGeometryN(2).ToString();
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft