gpt4 book ai didi

sql - ''geometry::Point' 失败,因为参数 1 不允许为空。将 latlng 转换为 GEOM 点时出错

转载 作者:行者123 更新时间:2023-12-01 02:47:38 25 4
gpt4 key购买 nike

我只是想简单地将出租车的纬度和经度坐标转换为几何点,但是当我进行查询时出现此错误:“geometry::Point”失败,因为参数 1 不允许为空。声明已终止。

UPDATE [dbo].[pdPoints] 
SET puGeom = GEOMETRY::Point(begintrip_lng, begintrip_lat, 4326),
dfGeom = GEOMETRY::Point(dropoff_lng, dropoff_lat, 4326)

我试过添加一条这条语句

WHERE 
begintrip_lng is not null
or dropoff_lng is not null
or begintrip_lat is not null
or dropoff_lat is not null
or country_id is not null
or city_id is not null;

但我得到了相同的结果。 :( 谁能帮忙?

最佳答案

你需要and而不是or

WHERE 
begintrip_lng is not null
and dropoff_lng is not null
and begintrip_lat is not null
and dropoff_lat is not null
and country_id is not null
and city_id is not null;

试试这个,你会看到一些行仍然有空,或者更多。任何 null 都会中断您的更新。

SELECT *
FROM pdPoints
WHERE
begintrip_lng is not null
or dropoff_lng is not null
or begintrip_lat is not null
or dropoff_lat is not null
or country_id is not null
or city_id is not null;

关于sql - ''geometry::Point' 失败,因为参数 1 不允许为空。将 latlng 转换为 GEOM 点时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33768594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com