Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
 STGeometryN (geography Data Type)
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
SQL Server 2008 Books Online (October 2009)
STGeometryN (geography Data Type)

Returns a specified geography element in a GeometryCollection or one of its subtypes. When STGeometryN() is used on a subtype of a GeometryCollection, such as MultiPoint or MultiLineString, this method returns the geography instance if called with N=1.

.STGeometryN ( expression )
expression

Is an int expression between 1 and the number of geography instances in the GeometryCollection.

SQL Server return type: geography

CLR return type: SqlGeography

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 geography instance and uses STGeometryN() to find the second geography instance of the GeometryCollection.

DECLARE @g geography;
SET @g = geography::STGeomFromText('MULTIPOINT(-122.360 47.656, -122.343 47.656)', 4326);
SELECT @g.STGeometryN(2).ToString();
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker