开发者

SQLServer Spatial query is returning error An expression of non-boolean type specified in a context where a condition is expected, near ')'

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 clos开发者_如何学编程ing 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


STIntersects returns 0 or 1. Try this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜