SQL “存储过程指定了太多参数” SQLServer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24394123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Stored Procedure has too many arguments specified" SQLServer
提问by NitroStoutPlz
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?
我是否没有正确指定此过程可以使用两个参数?
回答by user3727926
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.
您正在调用与您显示的过程不同的存储过程。sp_customer_city 定义的参数少于两个,这就是错误消息的含义。调用 sp_orders_by_dates 将起作用。