title: STWithin not working for Geography
body: <p><strong>Issue:</strong></p>
  
  <p>When executing <code>@somegeog.STWithin(@othergeog)</code> I get the execption:</p>
  
  <pre><code>Msg 6506, Level 16, State 10, Line 5
  Could not find method 'STWithin' for type 'Microsoft.SqlServer.Types.SqlGeography' in assembly 'Microsoft.SqlServer.Types'
  </code></pre>
  
  <p><strong>Background:</strong></p>
  
  <p>I am working with SQL Server (2008 R2) Geography data for the first time. I have a list of points in a table, and I want to retrieve those in a given area. I intend to write a stored procedure that accepts latitude and longitude bounds for the area.</p>
  
  <p>I can write this procedure easily by extracting the latitude and longitude from the stored geography points, but I was hoping to let the inbuilt functionality do the work. After googling the topic for a while, I found the <a href="http://msdn.microsoft.com/en-us/library/ff929207%28v=sql.110%29.aspx" rel="nofollow">STWithin method</a>, but even using Microsoft's example, I get an error claiming the method doesn't exist.</p>
  
  <p>MS Example from link:</p>
  
  <pre><code>DECLARE @g geography;
  DECLARE @h geography;
  SET @g = geography::Parse('POLYGON ((-120.533 46.566, -118.283 46.1, -122.3 47.45, -120.533 46.566))');
  SET @h = geography::Parse('CURVEPOLYGON (COMPOUNDCURVE (CIRCULARSTRING (-122.200928 47.454094, -122.810669 47.00648, -122.942505 46.687131, -121.14624 45.786679, -119.119263 46.183634), (-119.119263 46.183634, -119.273071 47.107523), CIRCULARSTRING (-119.273071 47.107523, -120.640869 47.569114, -122.200928 47.454094)))');
  SELECT @g.STWithin(@h);
  </code></pre>
  
  <p>Can somebody please explain what I'm doing wrong?</p>
  
  <p>Thanks in Advance!</p>