我正在使用SSRS 2008,并且正在尝试将以下数据集添加到我的报告中。但是,无论是将其添加为存储过程还是文本,添加后都不会显示任何字段。并且没有错误消息。解决方法和原因是什么?我有6个报告参数(按此顺序):
@END_YEAR VARCHAR(10), @END_MONTH VARCHAR(10), @END_WEEK VARCHAR(10), @TheTYPE VARCHAR(MAX), @IssueType VARCHAR(MAX), @Manager VARCHAR(MAX)
我确实将这些参数正确链接到我的存储过程。我能够添加我的其他数据集,这些数据集不是同一报告的动态SQL。我的存储过程是:
ALTER PROCEDURE ActionMetricsPageData
--DECLARE
@END_YEAR VARCHAR(10),
@END_MONTH VARCHAR(10),
@END_WEEK VARCHAR(10),
@TheTYPE VARCHAR(MAX), @IssueType VARCHAR(MAX), @Manager VARCHAR(MAX)
--SET @TheTYPE = 'All'
--SET @IssueType = '1'
--SET @Manager = 'All'
--AS
DECLARE @MainSQL VARCHAR(MAX)
DECLARE @START_DATE DATETIME
DECLARE @END_DATE DATETIME
IF @END_WEEK = '0' AND @END_MONTH = '12'
BEGIN
SET @START_DATE = CAST(('1/1/' + @END_YEAR) AS DATETIME)
SET @END_YEAR = CAST((CAST(@END_YEAR AS INT) + 1) AS VARCHAR(10))
SET @END_DATE = CAST(('1/1/' + (@END_YEAR)) AS DATETIME)
END
IF @END_WEEK = '0' AND @END_MONTH <> '12'
BEGIN
SET @END_MONTH = CAST((CAST(@END_MONTH AS INT) + 1) AS VARCHAR(10))
SET @END_DATE = CAST(((@END_MONTH) + '/1/' + @END_YEAR) AS DATETIME)
END
IF @END_WEEK <> '0'
BEGIN
SET @START_DATE = DATEADD(wk, @END_WEEK - 1, DATEADD(dd, -1, DATEADD(wk, DATEDIFF(wk,0,Convert(varchar(4), @END_YEAR) + '-01-01'), 0)))
SET @END_DATE = DATEADD(DAY, 7, @START_DATE)
END
IF @TheTYPE = 'All'
SET @TheTYPE = ' (IAT_PLAN_TYPE = ''Correction'' OR IAT_PLAN_TYPE = ''Corrective'' OR IAT_PLAN_TYPE = ''Preventive'' OR IAT_PLAN_TYPE = ''QSI - Corrective'' OR
IAT_PLAN_TYPE = ''QSI - Correction'' OR IAT_PLAN_TYPE = ''QSI - Preventive'' ) '
ELSE IF @TheTYPE = 'Corrective and Preventive'
SET @TheTYPE = ' (IAT_PLAN_TYPE = ''Corrective'' OR IAT_PLAN_TYPE = ''Preventive'') '
ELSE IF @TheTYPE = 'All QSI'
SET @TheTYPE = ' (IAT_PLAN_TYPE = ''QSI - Corrective'' OR IAT_PLAN_TYPE = ''QSI - Correction'' OR IAT_PLAN_TYPE = ''QSI - Preventive'') '
ELSE
SET @TheTYPE = ' (IAT_PLAN_TYPE = ' + @TheTYPE + ') '
IF @IssueType = '1'
SET @IssueType = ' (QEI_ITY_NAME = ''Correction (8.1)'' OR QEI_ITY_NAME = ''Corrective Action/Preventive Action'' OR QEI_ITY_NAME = ''Corrective | Preventive Action (8.1)'' OR
QEI_ITY_NAME = ''Investigation (8.1)'' OR QEI_ITY_NAME = ''Root Cause Investigation (8.1)'' OR QEI_ITY_NAME = ''Audit'' OR
QEI_ITY_NAME = ''Supplier Corrective | Preventive Action (8.1)'' OR QEI_ITY_NAME = ''PXP_PROCESS_QXP'' OR QEI_ITY_NAME = ''PXP_PRODUCT_QXP'') '
ELSE IF @IssueType = '2'
SET @IssueType = ' (QEI_ITY_NAME = ''Audit'') '
ELSE IF @IssueType = '3'
SET @IssueType = ' (QEI_ITY_NAME = ''Correction (8.1)'' OR QEI_ITY_NAME = ''Corrective Action/Preventive Action'' OR QEI_ITY_NAME = ''Corrective | Preventive Action (8.1)'' OR
QEI_ITY_NAME = ''Investigation (8.1)'' OR QEI_ITY_NAME = ''Root Cause Investigation (8.1)'') '
ELSE IF @IssueType = '4'
SET @IssueType = ' (QEI_ITY_NAME = ''PXP_PROCESS_QXP'' OR QEI_ITY_NAME = ''PXP_PRODUCT_QXP'') '
ELSE IF @IssueType = '5'
SET @IssueType = ' (QEI_ITY_NAME = ''Supplier Corrective | Preventive Action (8.1)'') '
IF @Manager = 'All'
SET @Manager = ' <> ''All'' '
ELSE
SET @Manager = '= '' REPLACE(''' + @Manager + ''','','''') '
--SELECT @Manager
SET @MainSQL =
'SELECT DISTINCT IAT_ID, DOC_DOCUMENT_NO, SGD_SIGNOFF_DATE, BTK_NAME, BTK_CLOSED_DATE, TSK_ANT_COMPL_DATE, IAT_PLAN_TYPE, ACT_MANAGER_NAME, QEI_ITY_NAME FROM
(SELECT SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.IAT_ID, SMARTSOLVE.V_QEI_QEX_ISSUE.DOC_DOCUMENT_NO,
CASE VH_QEI_QEX_ISSUE.QEI_ITY_NAME WHEN ''Audit'' THEN
(SELECT TOP (1) SMARTSOLVE.V_SGD_SIG_DETAIL_TSK.SGD_SIGNOFF_DATE FROM SMARTSOLVE.V_RVW_REVIEW_TSK INNER JOIN
SMARTSOLVE.V_SGD_SIG_DETAIL_TSK ON SMARTSOLVE.V_RVW_REVIEW_TSK.RVW_SGN_id = SMARTSOLVE.V_SGD_SIG_DETAIL_TSK.SGD_SGN_id
WHERE (SMARTSOLVE.V_RVW_REVIEW_TSK.RVW_id = SMARTSOLVE.V_IMT_IMPLEMENT_TSK.STK_CURRENT_REV_id)
ORDER BY SMARTSOLVE.V_SGD_SIG_DETAIL_TSK.SGD_SIGNOFF_DATE DESC) ELSE [PROC].FINAL_APPROVAL.SGD_SIGNOFF_DATE END AS SGD_SIGNOFF_DATE, SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.BTK_NAME,
SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.BTK_CLOSED_DATE, SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.TSK_ANT_COMPL_DATE, SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.IAT_PLAN_TYPE, SMARTSOLVE.V_PSN_PERSON.ACT_MANAGER_NAME, SMARTSOLVE.VH_QEI_QEX_ISSUE.QEI_ITY_NAME
FROM SMARTSOLVE.VH_QEI_QEX_ISSUE INNER JOIN
SMARTSOLVE.V_QEI_QEX_ISSUE ON SMARTSOLVE.VH_QEI_QEX_ISSUE.QEI_id = SMARTSOLVE.V_QEI_QEX_ISSUE.QEI_id INNER JOIN
SMARTSOLVE.V_IMT_IMPLEMENT_TSK ON
SMARTSOLVE.V_QEI_QEX_ISSUE.QEI_id = SMARTSOLVE.V_IMT_IMPLEMENT_TSK.BTK_DOC_id LEFT OUTER JOIN
[PROC].FINAL_APPROVAL ON SMARTSOLVE.V_IMT_IMPLEMENT_TSK.STK_CURRENT_REV_id = [PROC].FINAL_APPROVAL.RVW_id INNER JOIN
SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK ON
SMARTSOLVE.V_IMT_IMPLEMENT_TSK.IMT_id = SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.BTK_PARENT_id LEFT OUTER JOIN
SMARTSOLVE.V_PSN_PERSON ON SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.BTK_OWNER_id = SMARTSOLVE.V_PSN_PERSON.ACT_id
WHERE (SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.BTK_STATUS <> ''ABR'')
AND (CASE VH_QEI_QEX_ISSUE.QEI_ITY_NAME WHEN ''Audit'' THEN
(SELECT TOP (1) SMARTSOLVE.V_SGD_SIG_DETAIL_TSK.SGD_SIGNOFF_DATE FROM SMARTSOLVE.V_RVW_REVIEW_TSK INNER JOIN
SMARTSOLVE.V_SGD_SIG_DETAIL_TSK ON SMARTSOLVE.V_RVW_REVIEW_TSK.RVW_SGN_id = SMARTSOLVE.V_SGD_SIG_DETAIL_TSK.SGD_SGN_id
WHERE (SMARTSOLVE.V_RVW_REVIEW_TSK.RVW_id = SMARTSOLVE.V_IMT_IMPLEMENT_TSK.STK_CURRENT_REV_id)
AND [PROC].FINAL_APPROVAL.SGD_SIGNOFF_DATE >= @START_DATE AND [PROC].FINAL_APPROVAL.SGD_SIGNOFF_DATE < @END_DATE
ORDER BY SMARTSOLVE.V_SGD_SIG_DETAIL_TSK.SGD_SIGNOFF_DATE DESC) ELSE [PROC].FINAL_APPROVAL.SGD_SIGNOFF_DATE END IS NOT NULL)
AND (SMARTSOLVE.V_IMT_IMPLEMENT_TSK.BTK_NAME <> ''PQRE and /or Action Plan'') AND (SMARTSOLVE.V_IMT_IMPLEMENT_TSK.BTK_NAME <> ''Implement Required Actions'') AND
(SMARTSOLVE.V_IAT_IMPL_ACTPLAN_TASK.IAT_PLAN_TYPE <> ''Effectivity Check'')
UNION
SELECT SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_ID, SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_EXCEPTION_NO, SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_CREATED_DATE,
SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_XRS_DESCRIPTION, SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_CLOSED_DATE, NULL, SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_XRS_DESCRIPTION,
SMARTSOLVE.V_PSN_PERSON.ACT_MANAGER_NAME, SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_BASE_EXCEPTION
FROM SMARTSOLVE.V_QXP_ALL_EXCEPTION INNER JOIN
SMARTSOLVE.V_PSN_PERSON ON
SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_CLOSED_BY = SMARTSOLVE.V_PSN_PERSON.ACT_LOGONUSER
WHERE (SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_XRS_DESCRIPTION = ''Correction'') AND
(SMARTSOLVE.V_QXP_ALL_EXCEPTION.QXP_RESOLUTION <> ''300'')
)B
WHERE '
SET @MainSQL = @MainSQL + @TheTYPE + ' AND ' + @IssueType + ' AND ACT_MANAGER_NAME ' + @Manager
EXEC (@MainSQL)
答案 0 :(得分:0)
单击数据集属性的刷新字段按钮后,应检查sql profiler中报表的查询执行情况。