title: How to update table from spatial query
body: <p>I have two tables, A and B, in SQL Server 2008:</p>
  
  <pre><code>A
  lon(float)
  lat(float)
  name (nvarchar)
  
  B
  name (nvarchar)
  the_geom (geometry)
  </code></pre>
  
  <p>Basically table B contains area polygons, and table A contains point coordinates in two columns. I want to update table A with the area name, if the point defined in lon/lat columns is inside a polygon in table B. What is the correct T-SQL command? This is my unsuccessful query so far:</p>
  
  <pre><code>UPDATE A SET name = (SELECT name FROM B WHERE
  the_geom.STIntersects(geography::Point([A.lat], [A.Lon], 4326))&gt;0)
  </code></pre>