如何检查经度纬度数据库sql server

时间:2016-05-31 16:25:59

标签: sql sql-server sql-server-2008 sql-server-2012

我在地理围栏表中有经度和纬度如何检查数据库级别的经度和纬度。如果汽车经度纬度位于区域内,则更新地理位置栏区域='区域内的汽车'

CREATE TRIGGER Tr_CheckGeoFance
ON CheckGeoFance
AFTER INSERT AS
BEGIN
Update tblgeofencing
Set CarZone ='Car In Zone Area'
END
GO
ShapesString ={"shapes":[{"type":"rectangle","color":"#1E90FF","bounds":{"northEast":{"lat":"32.379961464357315","lon":"70.99365234375"},"southWest":{"lat":"31.840232667909362","lon":"70.2685546875"}}}]}

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

首先你必须解码当前为json格式的ShapesString,然后从解码的json中找出纬度和经度。 然后检查定义范围内的lat-long谎言以更新列。

请参考此解码json: - Parse JSON in TSQL