SQL Server 2008 R2:无法选择不同的几何数据类型,因为它没有可比性

时间:2022-09-05 16:37:59

My question is simple, I want to use union for two queries which has a geometry data type in it and it gives me this error.

我的问题很简单,我想对两个查询使用union,其中有一个几何数据类型,它给了我这个错误。

This is my query:

这是我的查询:

select 
    f.*, f.geom.STArea() as area, f.geom.STLength() as perimeter  
from 
    [dbo].[nosazi_shahrsazi_conne_leftJ]() as f,
    (select geom 
     from dbo.[GetWithinParcelWithApoint]('POLYGON ((5727454.0875024563 3838386.9047163716, 5727454.0875024563 3838391.8829422966, 5727459.06572838 3838391.8829422966, 5727459.06572838 3838386.9047163716, 5727454.0875024563 3838386.9047163716))') g) as h
where 
     h.geom.STTouches ( f.geom ) = 1 

union 

(select * 
 from dbo.[GetWithinParcelWithApoint]('POLYGON ((5727454.0875024563 3838386.9047163716, 5727454.0875024563 3838391.8829422966, 5727459.06572838 3838391.8829422966, 5727459.06572838 3838386.9047163716, 5727454.0875024563 3838386.9047163716))') g)

In fact I want to find all touching shapes around a shape and add the shape itself into result ..so I must use a union ..

事实上,我想在一个形状周围找到所有的触摸形状,然后把这个形状添加到结果中。所以我必须成立一个工会。

Is there any way to fix this error? Thanks

有什么办法可以改正这个错误吗?谢谢

1 个解决方案

#1


3  

Not sure if the error is inside of dbo.[GetWithinParcelWithApoint]. If so, we need to see the text.

不确定错误是否在dbo中[GetWithinParcelWithApoint]。如果是,我们需要看到文本。

From visible errors, you MUST use UNION ALL for GEOMETRY data type.

从可见的错误中,必须将UNION ALL用于几何数据类型。

#1


3  

Not sure if the error is inside of dbo.[GetWithinParcelWithApoint]. If so, we need to see the text.

不确定错误是否在dbo中[GetWithinParcelWithApoint]。如果是,我们需要看到文本。

From visible errors, you MUST use UNION ALL for GEOMETRY data type.

从可见的错误中,必须将UNION ALL用于几何数据类型。