lat附近的语法不正确,期待'('或选择 [英] Incorrect syntax near lat , expecting '(' or select

查看:45
本文介绍了lat附近的语法不正确,期待'('或选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DECLARE @g geography
SET @g=
geography::Point([Lat], [Long], 4326) as SAME_GEOM
FROM FencePointsBAHA FB
WHERE (Lat <> 0) AND (Long <> 0) and FenceIDFK=16

推荐答案

正如Tomas Takac所评论的那样,您可以使用选择@g = 语法。

As Tomas Takac has commented you can use the Select @g = syntax.
DECLARE @g geography;
select @g= geography::Point([Lat], [Long], 4326)
FROM FencePointsBAHA FB
WHERE (Lat <> 0) AND (Long <> 0) and FenceIDFK=16
;



确保where条件只返回一条记录,另一方面最后一条记录将填充@g。



但该套装也适用于一个选择语句:


Ensure the where condition returns only one record, other wise the last record will populate the @g.

But the set will also work with a select statement:

DECLARE @g geography;
SET @g= (select geography::Point([Lat], [Long], 4326) as SAME_GEOM
FROM FencePointsBAHA FB
WHERE (Lat <> 0) AND (Long <> 0) and FenceIDFK=16)
;



使用set方法时,请确保只返回一条记录。



我通常使用select方法填充变量,如果它通过表记录填充。



希望有所帮助。


When using the set method, ensure only one record is returned.

I usually use the select way to populate the variable if it is getting populated via a table record.

Hope that helps out.


这篇关于lat附近的语法不正确,期待'('或选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆