多くのドロップダウンパラメータを含むレポート(sprocに入れられる)で、SSRSで奇妙なエラーが発生します。
Query execution failed for dataset 'DataSet1'.
Must pass parameter number 3 and subsequent parameters as '@name = value'. After the form '@name = value' has been used, all subsequent parameters must be passed in the form '@name = value'
私はここで何が起こっているのか迷っています-何が意味するのか@name = value
。
オンラインで検索したところ、ストアドプロシージャを変更する必要があると誰かが言っていましたか?
これが私のストアドプロシージャの上半分がどのように見えるかです:
USE [FederatedSample]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[prc_RPT_Select_BI_Completes_Data_View_2]
@FromDate DATETIME,
@ToDate DATETIME,
@AccountIDs VARCHAR(max) = null,
@ClientIDs VARCHAR(max) = null,
@SupplierIDs VARCHAR(max) = null,
@CompleteType INT = NULL,
/*
* 0 - Routed
* 1 - Targeted
* 2 - Offerwall
*/
@SourceType BIT = NULL,
/*
* Works if @AccountID is not null
* (should only be used if @AccountID has a single value)
*
* 0 - Owned by @AccountID
* 1 - External (not owned by @AccountID)
*/
@SurveyStatus INT = NULL,
/*
* NULL - All Surveys
* 0 - Completes Approved Surveys
* 1 - Invoiced Surveys
*/
@IsSupplierUser BIT = 0
/*
* used to decide whether to display FEDSurveyName or SupplierSurveyName
*/
AS
BEGIN
SET NOCOUNT ON
DECLARE @SQL NVARCHAR(MAX) = N'',
@Params NVARCHAR(MAX)
IF @AccountIDs is not null
BEGIN
SET @SQL += N'DECLARE @AccountIDs VARCHAR(MAX) = @pAccountIDs; '
END
IF @ClientIDs is not null
BEGIN
SET @SQL += N'DECLARE @ClientIDs VARCHAR(MAX) = @pClientIDs; '
END
IF @SupplierIDs is not null
BEGIN
SET @SQL += N'DECLARE @SupplierIDs VARCHAR(MAX) = @pSupplierIDs; '
END
SET @SQL += N'
SELECT bi.SupplierID as ''Supplier ID''
,bi.SupplierName as ''Supplier Name''
,bi.PID as ''PID''
,bi.RespondentID as ''Respondent ID''
,lk_slt.Name as ''Entry Link Type''
,ts.SurveyNumber as ''Initial Survey ID'''
そして後でストアドプロシージャで。文字列を分割するには、次のような処理を行います。
IF @AccountIDs is not null
BEGIN
SET @SQL += CHAR(13) + CHAR(9)
SET @SQL += N' and bi.AccountID in (SELECT CAST(val as INT) FROM dbo.Split(@AccountIDs, '','