| title | STNumGeometries (geography Data Type) | ||
|---|---|---|---|
| description | STNumGeometries (geography Data Type) | ||
| author | MladjoA | ||
| ms.author | mlandzic | ||
| ms.date | 03/14/2017 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| ms.custom |
|
||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]
Returns the number of geometries that make up a geography instance.
.STNumGeometries ( )
[!INCLUDEssNoVersion] return type: int
CLR return type: SqlInt32
This method returns 1 if the geography instance is not a MultiPoint, MultiLineString, MultiPolygon, or GeometryCollection instance, or 0 if the geography instance is empty.
The following example creates a MultiPoint instance and uses STNumGeometries() to find out how many geometries the instance contains.
DECLARE @g geography;
SET @g = geography::STGeomFromText('MULTIPOINT((-122.360 47.656), (-122.343 47.656))', 4326);
SELECT @g.STNumGeometries();