Jeff S
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):
This is my error:
created batch id '1119476318'
CPS-DBPROD
CentricityPS
exception in mbcxp_AddToBatch(111947631 8,333,''0, 'null)'
msg=Procedure or function cusMPMBusStmt has too many arguments specified.
src=.Net SqlClient Data Provider
stk= at System.Data.SqlClient.SqlC onnection. OnError(Sq lException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlD ataReaderS mi.Interna lNextResul t(Boolean ignoreNonFatalMessages)
at System.Data.SqlClient.SqlD ataReaderS mi.NextRes ult()
at System.Data.SqlClient.SqlC ommand.Run ExecuteRea derSmi(Com mandBehavi or cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlC ommand.Run ExecuteRea der(Comman dBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlC ommand.Run ExecuteRea der(Comman dBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlC ommand.Exe cuteReader (CommandBe havior behavior, String method)
at System.Data.SqlClient.SqlC ommand.Exe cuteReader ()
at CResultGroup.AddRows(Strin g p_ServerName, String p_DbNameName, String p_Sql, CResultGroup p_rg)
at ServerProcedures.mbcxp_Add ToBatch(Sq lString p_ServerName, SqlString p_DbName, SqlInt32 p_batchID, SqlInt32 p_queryParameterID, SqlString p_logonName, SqlInt32 p_Optional1, SqlString p_Optional2)
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
This is my error:
created batch id '1119476318'
CPS-DBPROD
CentricityPS
exception in mbcxp_AddToBatch(111947631
msg=Procedure or function cusMPMBusStmt has too many arguments specified.
src=.Net SqlClient Data Provider
stk= at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlD
at System.Data.SqlClient.SqlD
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlC
at CResultGroup.AddRows(Strin
at ServerProcedures.mbcxp_Add
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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did indeed find the issue in the ReportNewBatch ... I will split points for looking and helping. Cheers.
ASKER