SQL Flow Field Guide

geography.STUnion

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

spatial method STUnion (instance.STUnion(...))

What changes

Input
spatial instance (and arguments)
Output or change
geography
Return type
SQL Server return type: geography CLR return type: SqlGeography

Syntax at a glance

.STUnion ( other_geography )

Work example

Use geography.STUnion to combine the point sets of two shapes.

Check matching SRIDs and inspect separate or mixed inputs. Confirm both values use the same SRID before comparing or combining them.

Check your work The union covers both polygons and their shared area; both inputs use SRID 4326.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

SELECT a.shape.STUnion(b.shape).STGeometryType() AS union_type, a.shape.STUnion(b.shape).STArea() AS union_area_m2 FROM (VALUES (geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326))) AS a(shape) CROSS JOIN (VALUES (geography::STGeomFromText('POLYGON((-122.351 47.656, -122.341 47.656, -122.341 47.661, -122.351 47.661, -122.351 47.656))', 4326))) AS b(shape);

Open Microsoft Learn for full syntax, permissions, and details for your version.