my database contains different objects like Polygons and Points. Each point is stored with a individual radius and index.
I retrieve all objects within a point radius with following sql query.
declare @g geometry select @g = Geom from obj where ObjectIndex = 1
declare @i float select @i = radius from obj where ObjectIndex = 1
select * from obj WITH(index(idx_Spatial)) where
Geom.STIntersects(@g.STBuffer(@i)) = 1
How do i have to change the query in order to get all points within my Polygon object (Declared object)? I tried following query with no success. Rembember: Radius is different!
declare @g geometry select @g = Geom from obj where ObjectIndex = 2
select * from obj WITH(index(idx_Spatial)) where
@g.STIntersects(Geom.STBuffer(radius)) = 1
The query processor could not produce a query plan for a query with a spatial index hint