我有一個存儲過程有幾個參數。它們中的大多數允許在下拉菜單中進行多項選擇。它們是:vOwner,vFunction,vSite,vStatus(允許所有多項選擇,並且「全選」也被啓用),然後是vStartDate和vEndDate。SSRS 2005 - 省略記錄
由於某些原因,當我爲每個參數選擇「全選」時,SSRS會切斷部分記錄。它似乎報告了除最後「所有者」記錄以外的所有內容。我正在尋找線索,爲什麼會發生這種情況。當我選擇一個日期的數據時,會發生這種情況。就好像最後的所有者甚至沒有被選爲數據集的一部分。
對於SSRS而言,設置非常簡單。我有一個引用存儲過程的數據集(下面),每個查找表都有一個(函數,狀態等等)任何幫助。讓我知道是否需要其他信息。謝謝!
存儲過程:
@vOwner varchar(1000) = NULL,
@vFunction varchar(1000) = NULL,
@vStatus varchar(1000) = NULL,
@vLocation varchar(1000) = NULL,
@vBeginDate datetime = NULL,
@vEndDate datetime = NULL
AS
BEGIN
--Allow for multiple owners, functions, etc. to be selected in SSRS.
Select @vOwner = ', ' + @vOwner + ', '
create table #Owner
(
Owner varchar(1000)
)
Insert Into #Owner
Select ManagerLastName + ', ' + ManagerFirstName As Owner
From Managers
Where @vOwner Like '%, ' + ManagerLastName + ', ' + ManagerFirstName + ', %'
Group By ManagerLastName, ManagerFirstName
--Function
Select @vFunction = ', ' + @vFunction + ', '
create table #Function
(
Functions varchar(1000)
)
Insert Into #Function
Select Functions
From Functions
Where @vFunction Like '%, ' + Functions + ', %'
Group By Functions
--Status
Select @vStatus = ', ' + @vStatus + ', '
create table #Status
(
IssueStatus varchar(1000)
)
Insert Into #Status
Select IssueStatus
From IssueStatus
Where @vStatus Like '%, ' + IssueStatus + ', %'
Group By IssueStatus
--Sites
Select @vLocation = ', ' + @vLocation + ', '
create table #Sites
(
siteName varchar(1000)
)
Insert Into #Sites
Select siteName
From Sites
Where @vLocation Like '%, ' + siteName + ', %'
Group By siteName
Select
recID,
siteName
functions
From issueInput
Where
@vFunction Like '%, ' + functions + ', %'
And @vOwner Like '%, ' + ManagerLastName + ', ' + ManagerFirstName + ', %'
And @vStatus Like '%, ' + IssueStatus + ', %'
And @vLocation Like '%, ' + SiteName + ', %'
And (@vBeginDate Is Null Or @vBeginDate = 0 Or @vBeginDate <= Cast(Convert(varchar,(OpenDate),101) As datetime))
And (@vEndDate Is Null Or @vEndDate = 0 Or @vEndDate >= Cast(Convert(varchar,(OpenDate),101) As datetime))
Order by OpenDate
END
你確定它是SSRS切斷結果而不是查詢的缺陷嗎?我不太關注它,但你應該能夠從SSMS向它傳遞相同的參數(全選),並驗證它是否返回了預期的結果。 – billinkc 2011-05-27 02:54:29