Christian
Christian

Reputation: 1853

"Stored Procedure has too many arguments specified" SQLServer

I have built a stored procedure:

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

When I execute the procedure using:

EXECUTE sp_customer_city 'January 1, 2003', 'June 30, 2003'

I receive:

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

Have I not properly specified that this procedure can take two arguments?

Upvotes: 2

Views: 27389

Answers (1)

user3727926
user3727926

Reputation: 106

You're calling a different stored procedure than the procedure you show was built. sp_customer_city has less than two arguments defined which is what the error message means. Calling sp_orders_by_dates will work.

Upvotes: 5

Related Questions