Created
May 1, 2019 05:38
-
-
Save zapkub/3af90acb8e6da55db1262d6a8390cbe1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @p geography = geography::Point(10.5, 10.5, 4326); | |
SELECT * | |
FROM ( | |
select Plant_ID,Plant_GeoLocation.STIsValid() as IsSTValid, Plant_GeoLocation.MakeValid().RingN(1).STDistance(@p) as Distance, Plant_GeoLocation as Geolocation from dbo.tb_opr_Plant | |
WHERE Plant_GeoLocation IS NOT NULL AND Plant_GeoLocation.STIsValid() = 1 | |
) DistanceMeastureFromPoint | |
WHERE Distance < 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment