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

SqlGeography.STGeometryN Method

Returns a specified geography element in a GeometryCollection or one of its subtypes.

Namespace:  Microsoft.SqlServer.Types
Assembly:  Microsoft.SqlServer.Types (in Microsoft.SqlServer.Types.dll)

[SqlMethodAttribute(IsDeterministic = true, IsPrecise = true)]
public SqlGeography STGeometryN(
	int n


Type: System.Int32
An int expression between 1 and the number of SqlGeography instances in the GeometryCollection.

Return Value

Type: Microsoft.SqlServer.Types.SqlGeography
A SqlGeography element from the specified instance in the GeometryCollection.

When this method is used on a subtype of a GeometryCollection, such as MultiPoint or MultiLineString, this method returns the SqlGeography instance if called with N=1.

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.

Community Additions

© 2015 Microsoft