带有日期参数的存储过程

use*_*163 3 parameters stored-procedures date

我正在尝试创建一个在执行时具有日期参数的存储过程.我希望能够搜索特定日期之间发送的订单.我有这个:

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
Run Code Online (Sandbox Code Playgroud)

并执行,我必须这样做:

EXEC sp_orders_by_dates '1991-07-01', '1991-08-31'
Run Code Online (Sandbox Code Playgroud)

我知道这部分是错的,但我无法弄清楚如何在这里做出"之间"声明:

where @startdate = ShippedDate,
        @enddate = ShippedDate
Run Code Online (Sandbox Code Playgroud)

小智 9

where ShippedDate BETWEEN @startdate and @enddate
Run Code Online (Sandbox Code Playgroud)