• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

SQL 2008 error - Procedure or function cusMPMBusStmt has too many arguments specified

I am running the following query in SQL 2008 (reportAddtoBatch SP in snippet below):

SET NOCOUNT ON

-- Determine which companies we are billing here.
DECLARE @id INT


CREATE TABLE #BatchId (Id INT)
INSERT INTO #BatchId EXEC ReportNewBatch 'cusMPMBusStmt'

SELECT @id = (SELECT TOP 1 Id FROM #BatchId)

INSERT INTO #BatchId EXEC ReportAddToBatch @id, 333

DROP TABLE #BatchId 

EXEC CrystalProc @id, 0

Open in new window


This is my error:

created batch id '1119476318'
CPS-DBPROD
CentricityPS
exception in mbcxp_AddToBatch(1119476318,333,''0,'null)'
msg=Procedure or function cusMPMBusStmt has too many arguments specified.
src=.Net SqlClient Data Provider
stk=   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlDataReaderSmi.InternalNextResult(Boolean ignoreNonFatalMessages)
   at System.Data.SqlClient.SqlDataReaderSmi.NextResult()
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderSmi(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at CResultGroup.AddRows(String p_ServerName, String p_DbNameName, String p_Sql, CResultGroup p_rg)
   at ServerProcedures.mbcxp_AddToBatch(SqlString p_ServerName, SqlString p_DbName, SqlInt32 p_batchID, SqlInt32 p_queryParameterID, SqlString p_logonName, SqlInt32 p_Optional1, SqlString p_Optional2)
USE [CentricityPS]
GO

/****** Object:  StoredProcedure [dbo].[reportAddToBatch]    Script Date: 10/15/2011 12:46:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


-- 19 Jan,2010 Ashok Nookala: Revised to accomodate a new parameter to pass it to MPMPatientProfile 
CREATE PROCEDURE [dbo].[reportAddToBatch]   @pBatchId int, @pId int, @pOpt1 int = 0,@LogonID varchar(30) = '',@reportParams varchar (50)=''  AS
BEGIN
SET NOCOUNT ON --SPR 35465
DECLARE @ServerName varchar(100)
SELECT  @ServerName = CONVERT(sysname, SERVERPROPERTY('servername')); 
Print   @ServerName

DECLARE @DBName     varchar(100)
select  @DBName     = Db_name()
Print   @DBName 

IF @reportParams= ''
BEGIN 
exec mbcxp_AddToBatch @ServerName, @DBName, @pBatchId, @pId, @LogonID, @pOpt1, null
END
ELSE
exec mbcxp_AddToBatch @ServerName, @DBName, @pBatchId, @pId, @LogonID, @pOpt1,@reportParams
END
------------------
--NOTE: The @LogonID parameters is NOT optional for internal uses.
--	 it was marked optional only as a comprimise to external users so that their existing calls to this procedure
--	 would continue to function without changes post CPOPM04-SP2
------------------


GO

Open in new window

0
Jeff S
Asked:
Jeff S
  • 2
2 Solutions
 
Anthony PerkinsCommented:
Please post the contents of Stored Procedure ReportNewBatch
0
 
Jeff SAuthor Commented:
Its in my code snippet.
0
 
TempDBACommented:
Hi Jeff,
      The message clearly says that there is some problem with the parameter passing for one of the stored procedure or sub-stored procedure being called. Just verify all the stored procedure call along with the parameters.And acperkins wanted to ask for the other stored procedure not the one you have specified in the latter part of your question:-


INSERT INTO #BatchId EXEC ReportNewBatch  'cusMPMBusStmt'
0
 
Jeff SAuthor Commented:
I did indeed find the issue in the ReportNewBatch ... I will split points for looking and helping. Cheers.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now