SQLServer 空间查询返回错误 在需要条件的上下文中指定的非布尔类型的表达式,靠近“)”

发布于 2024-10-26 09:56:21 字数 921 浏览 7 评论 0原文

我正在尝试学习如何使用新的 SqlServer 2008 托管空间类型和方法(地理)对记录进行半径搜索以进行地理空间计算。我正在关注此网页上的示例:

http://msdn.microsoft。 com/en-us/magazine/dd434647.aspx

我专门尝试执行此示例:

-- or declare POINT for "downtown Seattle"
-- 1609.344 meters per mile
DECLARE @Seattle geography = 'POLYGON(....)'; SELECT c.customerid FROM
 customer c WHERE c.geog.STIntersects(@Seattle.STBuffer(10 * 1609.344));

但是,即使在运行查询之前(或者当我运行 quer 时 - 编译和运行时错误)我也得到了以下错误消息:

An expression of non-boolean type specified in a context where a condition is expected, near ')'

我对此感到非常困惑。我没有执行完全相同的查询(我正在使用我自己的数据和地理列),但它与示例几乎相同。我正在运行 Sql SErver 2008 SP2 标准版 64 位。当我键入查询时,它使用 STIntersection 方法的智能感知并显示 (other_geography geography) 示例,以便它知道该方法存在。我正确地关闭了括号并用分号分隔表达式,但我无法弄清楚为什么会出现错误。谷歌搜索没有成功。

有什么想法吗?

赛斯

I am trying to learn how to do radius search on records using the new SqlServer 2008 managed spacial type and methods (geography) for doing geospatial calculations. I am following the samples on this web page:

http://msdn.microsoft.com/en-us/magazine/dd434647.aspx

I am specifically trying to do this sample:

-- or declare POINT for "downtown Seattle"
-- 1609.344 meters per mile
DECLARE @Seattle geography = 'POLYGON(....)'; SELECT c.customerid FROM
 customer c WHERE c.geog.STIntersects(@Seattle.STBuffer(10 * 1609.344));

However, even before running the query (or when I run the quer--both compile and runtime error)I am getting the following error message:

An expression of non-boolean type specified in a context where a condition is expected, near ')'

I am really baffled by this. I am not doing exactly the same query (I am using my own data with a geography column) but it is almost identical to the sample. I am running Sql SErver 2008 SP2 Standard Edition 64-bit. When I type the query it uses intellisense for the STIntersection method and shows a (other_geography geography) sample so it knows that the method exists. I am properly closing the parentheses and delimiting the expression with a semi-colon but I cannot figure out why I am getting the error. Googling has not worked.

Any thoughts?

Seth

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昵称有卵用 2024-11-02 09:56:21

STIntersects 返回 0 或 1。试试这个:

WHERE c.geog.STIntersects(@Seattle.STBuffer(10 * 1609.344)) = 1

STIntersects returns 0 or 1. Try this:

WHERE c.geog.STIntersects(@Seattle.STBuffer(10 * 1609.344)) = 1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文