Too Many Parameters in Stored Procedure Call
The error message "Procedure or function xxx too many arguments specified" indicates a mismatch between the number of parameters specified in a stored procedure call and the number of parameters declared in the stored procedure definition.
In this particular case, you are calling the stored procedure "[dbo].[M_UPDATES]" which in turn calls another stored procedure "[etl_M_Update_Promo]". The error occurs because "[etl_M_Update_Promo]" is declared to accept only one parameter @GenId, but you are passing it two parameters (@GenID and @Description) in the call from "[dbo].[M_UPDATES]".
Identifying the Mismatched Parameters
To identify the exact mismatch, examine the declaration of the stored procedure "[etl_M_Update_Promo]":
ALTER PROCEDURE [etl].[etl_M_Update_Promo] @GenId bigint = 0 as
This declaration specifies that the procedure takes one parameter, @GenId, which is a bigint data type and has a default value of 0. In your call from "[dbo].[M_UPDATES]", you are passing two parameters, but the second parameter (@Description) is not declared in the procedure definition, hence causing the error.
Adjusting the Parameter List
To resolve the error, you need to modify the declaration of "[etl_M_Update_Promo]" to include the second parameter:
ALTER PROCEDURE [etl].[etl_M_Update_Promo] @GenId bigint = 0, @Description NVARCHAR(50) AS .... Rest of your code.
By specifying @Description as an additional parameter in the procedure declaration, you can now pass it legally when calling "[etl_M_Update_Promo]" from "[dbo].[M_UPDATES]".
The above is the detailed content of Why Does My Stored Procedure Call Fail with 'Too Many Arguments Specified'?. For more information, please follow other related articles on the PHP Chinese website!