What I have so far:
select Metro.Object_ID
from Geocoding_tab.dbo.Part1_Part2_Combined_Final as paypal
,Object_id.dbo.All_Combined_9_Metros as Metro
where paypal.geom.STIntersect(Metro.GEOM) = 1;
You can amend the query to use JOIN syntax
SELECT Metro.Object_ID
FROM
Geocoding_tab.dbo.Part1_Part2_Combined_Final as paypal
INNER JOIN
Object_id.dbo.All_Combined_9_Metros as Metro ON paypal.geom.STIntersects(Metro.GEOM) = 1;
EDIT - following error shown in comments below
You can use the STIsValid Method to detect if you have shape that's invalid. The method will return 0 if invalid.
The MakeValid Method will fix invalid shape data
for example:
UPDATE table SET geom = geom.MakeValid() where geom.STIsValid() = 0
Note
As the error suggests, the MakeValid could alter your shape in a way that you might consider incorrect, depending on the original problem with the shape. So you should confirm that you're happy with the "corrected" shape before proceeding.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.