title: Stored Procedure with date parameters
body: <p>I'm trying to create a stored procedure that has date parameters upon execution.  I want to be able to search for orders shipped between particular dates.  I have this:</p>
  
  <pre><code>create procedure sp_orders_by_dates
          @startdate smalldatetime,
          @enddate smalldatetime
  as
  select  OrderID,
          o.CustomerID,
  
          c.CompanyName as CustomerCompany,
          s.ShipperID,
          s.CompanyName as ShipperCompany,
          ShippedDate
  
  from    Orders o join Customers c
  on      o.CustomerID = c.CustomerID join Shippers s
  on      s.ShipperID = o.ShipperID
  where @startdate = ShippedDate,
          @enddate = ShippedDate
  order by ShippedDate
  </code></pre>
  
  <p>and to execute, i have to do it this way:</p>
  
  <pre><code>EXEC sp_orders_by_dates '1991-07-01', '1991-08-31'
  </code></pre>
  
  <p>I know this part is what's wrong but I just can't figure out how to make the "between" statement here:</p>
  
  <pre><code>where @startdate = ShippedDate,
          @enddate = ShippedDate
  </code></pre>