Link to home
Start Free TrialLog in
Avatar of Jeff S
Jeff SFlag for United States of America

asked on

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

SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeff S

ASKER

Its in my code snippet.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeff S

ASKER

I did indeed find the issue in the ReportNewBatch ... I will split points for looking and helping. Cheers.