“存储过程指定了太多参数”SQLServer

时间:2014-06-24 18:49:44

标签: sql sql-server stored-procedures sql-server-2012

我已经构建了一个存储过程:

CREATE PROCEDURE dbo.sp_orders_by_dates 
    @start_date datetime,
    @end_date datetime
AS
    SELECT
      order_id, 
      orders.customer_id, 
      customers.name,
      shippers.name,
      shipped_date
    FROM orders 
    INNER JOIN customers ON orders.customer_id = customers.customer_id
    INNER JOIN shippers ON orders.shipper_id = shippers.shipper_id
    WHERE shipped_date BETWEEN @start_date AND @end_date

当我使用:

执行程序时
EXECUTE sp_customer_city 'January 1, 2003', 'June 30, 2003'

我收到:

Msg 8144, Level 16, State 2, Procedure sp_customer_city, Line 0
Procedure or function sp_customer_city has too many arguments specified.

我没有正确指定此过程可以采用两个参数吗?

1 个答案:

答案 0 :(得分:5)

您正在调用与您显示的过程不同的存储过程。 sp_customer_city定义的参数少于两个,这是错误消息的含义。调用sp_orders_by_dates将起作用。