Skip to content

Latest commit

 

History

History
67 lines (53 loc) · 2.08 KB

unionaggregate-geometry-data-type.md

File metadata and controls

67 lines (53 loc) · 2.08 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom helpviewer_keywords dev_langs
UnionAggregate (geometry Data Type)
UnionAggregate (geometry Data Type)
MladjoA
mlandzic
08/03/2017
sql
t-sql
reference
ignite-2024
UnionAggregate method (geometry)
TSQL

UnionAggregate (geometry Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]

Performs a union operation on a set of geometry objects.

Syntax

  
UnionAggregate ( geometry_operand )  

Arguments

geometry_operand
Is a geometry type table column that holds the set of geometry objects on which to perform a union operation.

Return Types

[!INCLUDEssNoVersion] return type: geometry

Exceptions

Throws a FormatException when there are input values that are not valid. See STIsValid (geometry Data Type)

Remarks

Method returns null when the input is empty or the input has different SRIDs. See Spatial Reference Identifiers (SRIDs)

Method ignores null inputs.

Note

Method returns null if all inputted values are null.

Examples

The following example returns the union of a set of geometry objects in a table variable.

-- Setup table variable for UnionAggregate example 
DECLARE @Geom TABLE 
( 
shape geometry, 
shapeType nvarchar(50) 
); 
INSERT INTO @Geom(shape,shapeType) 
VALUES('CURVEPOLYGON(CIRCULARSTRING(2 3, 4 1, 6 3, 4 5, 2 3))', 'Circle'), 
('POLYGON((1 1, 4 1, 4 5, 1 5, 1 1))', 'Rectangle'); 
-- Perform UnionAggregate on @Geom.shape column 
SELECT geometry::UnionAggregate(shape).ToString() 
FROM @Geom;

See Also

Extended Static Geometry Methods