title: Sql Server - How do I query a geography column based on Lat/Long min max
body: <p>I have a table with a geography column that stores the location of a property.</p>
  
  <p>I have a procedure something like this - </p>
  
  <pre><code>PROCEDURE dbo.spt_sold_property_search
  (
  @latitude_min   Decimal(9,6),
  @latitude_max   Decimal(9,6),
  @longitude_max  Decimal(9,6),
  @longitude_min  Decimal(9,6)
  )
  
  AS BEGIN    
  
  SET NOCOUNT ON
  
  SELECT * FROM [dbo].[sold_property] AS p WITH(NOLOCK)
  WHERE p.location ***is in the lat/long min max bounds***
  
  END
  </code></pre>
  
  <p>What would I need in the where clause to check if the geography point is in the bounds of the Lat/Long min max? It is an large dataset so performance is a critical. </p>
  
  <p>Should I be creating a Geography SQL type in code from the bounds and pass that into the proc as a procedure?</p>
  
  <p>I was also considering creating 2 calculated int columns (lat/long) which would be created on insert, and then simple &lt;  > as I heard that is faster than Geography queries.</p>