The key objective for most spatial queries is to try to understand the relationship between two or more features on the Earth in order to answer specific questions: for example, how far is it from a to b? Does the route between x and y pass through z? Does p share a common border with q? In this chapter, I'll introduce the methods that SQL Server provides to answer these questions by comparing different aspects of the relationship between two items of spatial data.
STDistance() method can be used to calculate the shortest distance between any two geometries. When used on instances of the
geometry datatype, this is the length of the shortest straight ...