I have a set of spatial objects in a MSSQL server 2008 R2 trying to dissolve adjoining objects where one of the attributes are equal. The table below is somewhat representative to my original table:

id     year     GEOM
01     1999     0x79F...
02     2013     0x79F...
03     1988     0x79F...
04     2013     0x79F...
05     1999     0x79F...
06     2013     0x79F...

Many of the objects above are neighbours so I would like to aggregate the spatial objects so that I in the end of the day end up with a smaller number of table entries/objects where possible. I am not looking for myltipolygons.

I have looked around and a propper dissolve functionality like the one available in for example ArcGIS desktop. MSSQL 2008 R2 does not seem to sport this functionality directly.

Is there a way to send a query to the database which does this job for me?

1 Answer 1


MSSQL server 2008 does not support spatial aggregation. BostonGIS provides a comparison between MSSQL Server 2008, PostGIS and mysql. In this comparison the following is said:

Spatial Aggregates (functions like SUM but for spatial)

Apparently none in this release so have to roll your own with CLR. There are numerous examples of this on the web. UPDATE SQL Server 2008 Spatial Tools contains aggregate functions for Union and Envelop similar to PostGIS ST_Union and ST_Extent functions

CLR means Common Language Runtime.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.