title: How to compare dates in SQL stored procedure?
body: <p>I want to query the database within a stored procedure with the following SQL statement:</p>
  
  <pre><code>SELECT date1 FROM table INTO dates
  WHERE date1 &lt; CONVERT(VARCHAR(8), GETDATE(), 112)
  AND date1 &gt; CONVERT(VARCHAR(8), DATEADD(DAY, -4, GETDATE()), 112);
  </code></pre>
  
  <p>I get an error on the WHERE clause, what am I doing incorrectly?</p>