我正在 Visual Studio 2010 中处理一个简单的报告,最初我有一个直接查询:
SELECT
DOCDATE, DOCID, CUSTNMBR, CUSTNAME, DOCAMNT
FROM
SOP30200
WHERE
(DOCDATE BETWEEN @Fromdate AND @Todate)
GROUP BY
DOCDATE, DOCID, CUSTNMBR, CUSTNAME, DOCAMNT
HAVING
(CUSTNAME = @Custname OR @Custname IS NULL) AND (DOCID IN (@DocID))
将DOCID
参数设置为“允许多个值”,效果很好。
但是,当我创建存储过程时:
CREATE Procedure [dbo].[Jae_EraSales]
@Custname nVARCHAR(MAX),
@DocID nVARCHAR(50),
@Fromdate datetime,
@Todate datetime
as
SELECT
DOCDATE, DOCID, CUSTNMBR, CUSTNAME, DOCAMNT
FROM
SOP30200
WHERE
(DOCDATE BETWEEN @Fromdate AND @Todate)
GROUP BY
DOCDATE, DOCID, CUSTNMBR, CUSTNAME, DOCAMNT
HAVING
(CUSTNAME = @Custname) AND (DOCID IN (@DocID))
GO
并将存储过程用作我的数据集……SSRS 报告不会提取任何内容。它只提取具有单个DOCID
值的数据。
谁能解释为什么会这样?
先感谢您!