"Stored Procedure has too many arguments specified" SQLServer

27,158

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.

Share:
27,158
ChristianF
Author by

ChristianF

Updated on July 23, 2022

Comments

  • ChristianF
    ChristianF almost 2 years

    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?

  • crthompson
    crthompson almost 10 years
    Lol, I totally missed this point. It may just be a typo, but +1 for good eyes.
  • ChristianF
    ChristianF almost 10 years
    Ah. Wow. I was looking at it for 15 mins without a clue. Completely missed that. Thanks for the help. Will accept answer in 7 mins. Cheers.
  • Pablo Durán
    Pablo Durán over 8 years
    If you alredy modified a stored procedure and you still getting that error, should be because you've the same query opened in other tab ... shit happens :(