SQLServer 空间查询返回错误 在需要条件的上下文中指定的非布尔类型的表达式,靠近“)”
我正在尝试学习如何使用新的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
STIntersects 返回 0 或 1。试试这个:
STIntersects returns 0 or 1. Try this: