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

STUnion (geography Data Type)

Returns an object representing the union of a geography instance with another geography instance.

.STUnion ( other_geography )


Is another geography instance to form a union with the instance on which STUnion() is being invoked.

SQL Server return type: geography

CLR return type: SqlGeography

This method always returns null if the spatial reference identifiers (SRIDs) of the geography instances do not match.

The following example uses STUnion() to compute the union of two Polygon instances.

DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326);
SET @h = geography::STGeomFromText('POLYGON((-122.351 47.656, -122.341 47.656, -122.341 47.661, -122.351 47.661, -122.351 47.656))', 4326);
SELECT @g.STUnion(@h).ToString();

Community Additions

© 2015 Microsoft