EDIT: you can use EnvelopeAggregate instead of UnionAggregate and STEnvelope, of course ...
You can execute UnionAggregate on all polygons, put STEnvelope around it and visually select the values XMin, YMin, XMax, YMax. Of course, you can do some TSQL manipulations with the STAsText bounding box, but I will leave this as a manual exercise.
This gives you a field that covers your existing polygons, but you should think about how many indents you need or what borders are needed for future data.
Example:
use tempdb; create table GeometryTest( id int identity primary key, geom Geometry ); insert GeometryTest values ( 'POLYGON((-130 54, -130 23, -60 23, -60 54, -130 54))' ); insert GeometryTest values ( 'POLYGON((1 0, 0 0, 0 1, 1 1, 3 5, 1 0))' ); insert GeometryTest values ( 'POLYGON((0 0, -100 5, 0 60, 70 70, 3 5, 0 0))' ); select geometry::UnionAggregate ( geom ).STEnvelope().STAsText() from GeometryTest;
source share