为什么我会收到错误201过程或函数是否需要未提供的参数?

时间:2021-02-09 01:51:28

When I run the code below I get an error message:

当我运行下面的代码时,我收到一条错误消息:

DECLARE @return_value int

EXEC    @return_value = [dbo].[stp_DespatchedJob]
        @JobStatusId = NULL

SELECT  'Return Value' = @return_value
GO

Msg 201, Procedure stp_DespatchedJob, Line 0
Procedure or Function 'stp_DespatchedJob' expects parameter '@jobId', which was not supplied

消息201,过程stp_DespatchedJob,行0过程或函数'stp_DespatchedJob'期望参数'@jobId',未提供

What does this mean? Why am I getting this error?

这是什么意思?为什么我收到此错误?

1 个解决方案

#1


1  

It means that you are trying to call a stored procedure that has a required parameter that you are not passing. I can't tell you exactly what your syntax should look like without knowing the parameters of the procedure. You will have to look at the parameters on the procedure and make sure all of the parameters without defaults are passed in the EXEC statement. But to add the @jobId to your EXEC statement it would look something like this:

这意味着您正在尝试调用具有您未传递的必需参数的存储过程。在不知道过程参数的情况下,我无法准确地告诉您语法应该是什么样子。您将不得不查看过程中的参数,并确保在EXEC语句中传递所有没有默认值的参数。但是要将@jobId添加到您的EXEC语句中,它看起来像这样:

EXEC    @return_value = [dbo].[stp_DespatchedJob]
        @JobStatusId = NULL,
        @jobId=7

#1


1  

It means that you are trying to call a stored procedure that has a required parameter that you are not passing. I can't tell you exactly what your syntax should look like without knowing the parameters of the procedure. You will have to look at the parameters on the procedure and make sure all of the parameters without defaults are passed in the EXEC statement. But to add the @jobId to your EXEC statement it would look something like this:

这意味着您正在尝试调用具有您未传递的必需参数的存储过程。在不知道过程参数的情况下,我无法准确地告诉您语法应该是什么样子。您将不得不查看过程中的参数,并确保在EXEC语句中传递所有没有默认值的参数。但是要将@jobId添加到您的EXEC语句中,它看起来像这样:

EXEC    @return_value = [dbo].[stp_DespatchedJob]
        @JobStatusId = NULL,
        @jobId=7