0

我的数据库包含不同的对象,例如多边形和点。每个点都存储有单独的半径和索引。

在此处输入图像描述

我使用以下 sql 查询检索点半径内的所有对象。

 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 

我如何更改查询以获取我的多边形对象(声明的对象)中的所有点?我尝试了以下查询但没有成功。记住:半径不同!

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 

查询处理器无法为带有空间索引提示的查询生成查询计划

4

0 回答 0