2013-07-25 71 views
2

我有一個調用存儲過程的報告。該proc有3個參數聲明,但我在運行時收到錯誤「過程沒有參數和參數提供」。我不確定還有什麼要做。SSRS過程沒有參數並提供參數

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 

回答

3

請用這種格式

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 

檢查,我認爲你聲明的過程

0

內部參數嘗試刪除「/ *」和「 - 」從這些線你的意見中提出。這些可能是它抱怨的路線。這些行不會被執行,並且包含使用這些參數的參數。

+0

這是一個參數特定的問題...沒有評論相關的我認爲。 – Riad

相關問題