title: Getting list of spatial points from polygon within query
body: <p>I have a database with various defined polygons which represent the outer boundarys of buildings on a map of a business park.</p>
  
  <p>If I perform a Select within Management Studio, I get a result similar to the following:</p>
  
  <pre><code>LocationCode    LocationPolygon
  1               POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))
  2               POLYGON((10 10, 20 10, 20 20, 10 20, 10 10))
  </code></pre>
  
  <p>What I would like to get is the following:</p>
  
  <pre><code>LocationCode    PointX    PointY
  1               1         1
  1               2         1
  1               2         2
  1               1         2
  2               10        10
  etc             etc       etc
  </code></pre>
  
  <p>I cannot see anywhere where I can extract the points from the Polygon using SQL Server from within a SQL Query? I can evidentally take the whole polygon and then do the rest on the client, but I would rather deal in SQL if possible.</p>
  
  <p>Any help appreciated in pointing me in the right direction.</p>