0
我有一個存儲過程位於Crystal Report中的命令對象中。我需要通過一個日期。我在命令參數窗口中定義了startdate和enddate。使用日期參數調用水晶報表中的命令對象11中的存儲過程
這是我在水晶中定義的對象參數:
Startdate – string . default value = ‘t-1’
Enddate - string. default value = ‘t-1’
它不報錯了,但一直運行,我不得不終止。我究竟做錯了什麼?
這是水晶的命令對象內部代碼:
DECLARE @StatisticStartDate as datetime = EPIC_UTIL.EFN_DIN({?startdate});
DECLARE @StatisticEndDate as datetime = dateadd(s, 86399, EPIC_UTIL.EFN_DIN({?enddate}));
DECLARE
[email protected] nvarchar(20), -- Change all of these to the data types of the specific columns...
[email protected] nvarchar(20),
@CostCenterList nvarchar(200),
@ProcedureCodeList nvarchar(100),
@Statistic nvarchar(100),
@StatisticDescription VARCHAR(255),
@RVValue numeric(18,0),
@Fiscalyear int,
@PatientTypeIndicator nvarchar(100),
@PatientServiceList nvarchar(100),
@PatientClassList nvarchar(100),
@PatientStatusList nvarchar(100);
DECLARE @Output TABLE (
[Facility ID] INT,
[Stat Date] DATETIME,
[DEPARTMENT] VARCHAR(200),
[Statistic Name] VARCHAR (200),
[Statistic Description] VARCHAR (200) ,
[Patient Type Indicator] VARCHAR (2),
[Daily Quantity] DECIMAL(18,2) ,
[Daily Amount] DECIMAL(18,2),
COST_CENTER_NAME VARCHAR(200) ,
[Fiscal Year] INT
)
DECLARE Setting_cur CURSOR FOR
SELECT
StatisticStartDate,
StatisticEndDate,
CostCenterList,
ProcedureCodeList,
Statistic,
StatisticDescription,
PatientTypeIndicator,
RVThreshold,
PatientServiceList,
PatientClassList,
PatientStatusList,
FiscalYear
FROM
ssisconfiguration.dbo.BalladHealthDayOneStats
--WHERE
--FiscalYear = 2017
;
OPEN Setting_cur
FETCH NEXT FROM Setting_cur INTO @StatisticStartDate, @StatisticEndDate,
@CostCenterList, @ProcedureCodeList,
@Statistic, @StatisticDescription,
@PatientTypeIndicator, @RVValue,
@PatientServiceList, @PatientClassList,
@PatientStatusList, @FiscalYear
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT @Output
EXEC [SSIS].[sp_BalladDayOneMaster] [email protected] = Clarity.ssis.sp_GetFinancialStatsByFinParams
@SD = @StatisticStartDate,
@ED = @StatisticEndDate,
@CostCenterList = @CostCenterList,
@ProcedureCodeList = @ProcedureCodeList,
@Statname = @Statistic,
@StatDescription = @StatisticDescription,
@PatientTypeIndicator = @PatientTypeIndicator,
@RVvalue = @RVValue,
@FiscalYear = @FiscalYear,
@PatientClassList = @PatientClassList ,
@PatientStatusList = @PatientStatusList,
@PatientServiceList = @PatientServiceList
FETCH NEXT FROM Setting_cur INTO @StatisticStartDate, @StatisticEndDate,
@CostCenterList, @ProcedureCodeList,
@Statistic, @StatisticDescription,
@PatientTypeIndicator, @RVValue,
@PatientServiceList, @PatientClassList,
@PatientStatusList, @FiscalYear
END
CLOSE Setting_cur
DEALLOCATE Setting_cur
SELECT * FROM @Output
非常感謝! – SQLNewbie