I am using sql server 2008 R2 and I have two tables, regions and objects. Both have a column containing a geography element.
I want to calculate the union at the intersection of georegulation elements, for example:
SELECT * from Regions join Facilities on [Regions].[geography].STIntersects([Facilities].[geography])
which of course does not work. Regions are large polygons, and objects are points, each of which is contained in only one polygon.
I can write some (pseudo code)
for each r in Regions: for each f in Facilities: if f.[geography].STIntersects(r.[geography]): print r, f
but the whole point of using a database is to work with many, not elements, right?
So, is there a better way to do this?
thanks melanie
source share