Reputation: 421
I have a report calling a stored proc. The proc has 3 parameters declared but I am getting the error "Procedure has no parameters and arguments were supplied" at runtime. I'm not really sure what else to do.
ALTER PROCEDURE [dbo].[uspFirstCurveProcess] AS
DECLARE @Period int
DECLARE @Year varchar(4)
DECLARE @FacilityID int;
/* SET @period = 4
SET @FacilityID = 3101
SET @Year = 2013; */
WITH Process_cte AS (
SELECT [FacilityID]
,[FiscalYear]
-- ,[MonthNumber]
,[Measure]
,[SubAccount]
,SUM([MthAmt]) AS MthAmt
,SUM([BudgAmt]) AS BudgAmt
,0 AS [YTDAmt]
FROM EVAL.dbo.FirstCurveProcess
WHERE FacilityID = @FacilityID
AND MonthNumber = @Period
AND FiscalYear = @Year
GROUP BY FacilityID,FiscalYear,Measure,Subaccount
UNION
SELECT [FacilityID]
,[FiscalYear]
-- ,[MonthNumber]
,[Measure]
,[SubAccount]
,0 AS [MthAmt]
,0 AS [BudgAmt]
,SUM(MthAmt) AS [YTDAmt]
FROM EVAL.dbo.FirstCurveProcess
WHERE FacilityID = @FacilityID
AND MonthNumber <= @Period
AND FiscalYear = @Year
GROUP BY FacilityID,FiscalYear,Measure,SubAccount --MonthNumber,
)
SELECT [FacilityID]
,[FiscalYear]
-- ,[MonthNumber]
,[Measure]
,[SubAccount]
,SUM([MthAmt]) AS MthAmt
,SUM([BudgAmt]) AS BudgAmt
,SUM(YTDAmt) AS [YTDAmt] FROM Process_cte
GROUP BY FacilityID,FiscalYear,Measure,Subaccount
Upvotes: 2
Views: 2892
Reputation: 1
Try removing "/*" and "--" from those lines you made as comments. Those are probably the lines it's complaining about. Those lines won't be executed and you included arguments using those parameters.
Upvotes: 0
Reputation: 116
please check with this format
GO
IF OBJECT_ID(N'[dbo].[uspFirstCurveProcess]',N'P') IS NOT NULL
DROP PROCEDURE [dbo].[uspFirstCurveProcess]
GO
CREATE PROCEDURE [dbo].[uspFirstCurveProcess]
(
@Period int
,@Year varchar(4)
,@FacilityID int
)
as
begin
//your code
end
i think you declared parameters inside the procedure
Upvotes: 4