title: Stored procedure which count records between two dates
body: <p>I am trying to count records with status 0 between two dates in SQL server 2008 
  have my procedure but it is not right trows error.</p>
  
  <blockquote>
    <p><em>Msg 156, Level 15, State 1, Procedure sp_SerchPickupHispanicBetweenDates, Line 6<br>
    Incorrect syntax near the keyword 'between'.</em></p>
  </blockquote>
  
  <p>Procedure looks like </p>
  
  <pre><code>CREATE procedure sp_SerchPickupHispanicBetweenDates
  @date1 date,
  @date2 date
  as 
  select COUNT ( Pickuphispanic ) from  pickup
  where  Pickuphispanic = 1 and pickupdate like between @date1+ '%' and @date1 +'%'
  </code></pre>
  
  <p>was trying search solution in internet but no success.
  Any Ideas how to wright it correct?
  also i have  select statment which works perfectly </p>
  
  <pre><code>select COUNT ( Pickuphispanic ) from  pickup
  where  Pickuphispanic = 1 and pickup.pickupdate between '2006-07-01' and '2010-12-31'
  </code></pre>