title: How to calculate distance of two points along line in TSQL
body: <p>I have added line in the MSSQL database which represent a route in map.As,</p>
  
  <pre><code>update route
    set locationArray=geography::STGeomFromText('LINESTRING(7.068419558716859 80.140939950943,7.070868430303301 80.14106869697571,7.072976578922316 80.14136910438538,7.074339417352194 80.14203429222107,7.07631978477513 80.14278531074524,7.078491790888004 80.14435172080994,7.078300143701023 80.14649748802185,7.078449202631107 80.14877200126648,7.076617903866453 80.15068173408508,7.074978246481405 80.15248417854309,7.074105179783337 80.15490889549255,7.0723803358444135 80.15643239021301)', 4326)
    where routeID=45;
  </code></pre>
  
  <p>Now I chose two points in the line and I wand to calculate distance between those two lines along the line (Not the direct distance or displacement) similar to the image .
  <a href="https://i.stack.imgur.com/11emK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/11emK.png" alt="enter image description here"></a></p>
  
  <p>I have tried Both STLength() function and STDistance() functions. But both of them are providing direct distance. Can someone please help me to calculate the distance along the line with using TSQL?</p>