SSRS慢然后错误
SSRS slow then Error
我使用 SSRS 报告创建图表报告并在 MS CRM 中使用此报告
当运行 用户可以选择每天/每月/每年或每季度的报告显示摘要时,我的报告在参数部分显示摘要
然后报告在一些行时正常工作但是当我选择每天显示并选择 2014-01-01 和 2015-03-23 之间的日期范围报告 运行 太长然后我得到 this error
然后我 运行 在 Sql server management studio 中查询 运行 00:00:00 秒和 return 1814 行
这是我的查询
DECLARE @paramSdate AS DATE = (SELECT CAST('2014-01-01' AS DATE))
DECLARE @paramNdate AS DATE = (SELECT CAST('2015-03-23' AS DATE))
DECLARE @sdate AS DATE
,@edate AS DATE
SET @sdate = @paramSdate
SET @edate = @paramNdate
CREATE TABLE #tmp (x DATE,link INT)
WHILE @sdate <= @edate
BEGIN
INSERT INTO #tmp VALUES(@sdate,1)
SET @sdate = DATEADD(DAY,1,@sdate)
END
SELECT FORMAT(t.x,'dd/MM/yyyy','TH-th') AS [x]
,h.name
,ISNULL(cc.cnt,0) AS [cnt]
FROM #tmp t
LEFT JOIN (
SELECT 2 AS [type] , 'New Visit' AS [name] ,1 AS [link]
UNION
SELECT 3 AS [type] , 'Re-Visit' AS [name] ,1 AS [link]
UNION
SELECT 4 AS [type] , 'Book' AS [name] ,1 AS [link]
UNION
SELECT 5 AS [type] , 'Total' AS [name] , 1 AS [link]
) h ON t.link = h.link
LEFT JOIN (
SELECT COUNT(*) AS [cnt]
,CAST(v.new_contactdate AS DATE) AS [d]
,v.new_type
FROM [SCASSET_MSCRM].[dbo].[new_VisitHistory] v with(nolock)
WHERE v.new_type IN (2)
AND v.new_projectid IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND CAST(v.new_contactdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY v.new_type
,CAST(v.new_contactdate AS DATE)
UNION
SELECT COUNT(*) AS [cnt]
,CAST(v.new_contactdate AS DATE) AS [d]
,'3' AS [new_type]
FROM [SCASSET_MSCRM].[dbo].[new_VisitHistory] v with(nolock)
WHERE v.new_type IN (3,4)
AND v.new_projectid IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND CAST(v.new_contactdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY v.new_type
,CAST(v.new_contactdate AS DATE)
UNION
SELECT COUNT(*) AS [cnt]
,CAST(s.new_reservationdate AS DATE) AS [d]
,'4' AS [new_type]
FROM [SCAsset_MSCRM].[dbo].[new_salehistory] s with(nolock)
WHERE s.new_projectId IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND CAST(s.new_reservationdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY
CAST(s.new_reservationdate AS DATE)
UNION
SELECT COUNT(*) AS [cnt]
,CAST(v.new_contactdate AS DATE) AS [d]
,'5' AS [new_type]
FROM [SCAsset_MSCRM].[dbo].[new_VisitHistory] v with(nolock)
WHERE v.new_projectId IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND v.new_type IN (2,3,4)
AND CAST(v.new_contactdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY
CAST(v.new_contactdate AS DATE)
) cc ON cc.new_type = h.[type]
AND CAST(cc.d AS DATE) = CAST(t.x AS DATE)
ORDER BY t.x
OPTION(RECOMPILE)
DROP TABLE #tmp
这是我的 data set and report design
谢谢。
这可能是记录过多和您的报告 and/or 数据库超时的问题。我相信情况确实如此,因为当您将数据集限制为只有几条记录时,报告就会运行。
我会查看此资源以获取解决此问题的更多帮助。what is the default timeout processing option in SSRS Server
我使用 SSRS 报告创建图表报告并在 MS CRM 中使用此报告
当运行 用户可以选择每天/每月/每年或每季度的报告显示摘要时,我的报告在参数部分显示摘要
然后报告在一些行时正常工作但是当我选择每天显示并选择 2014-01-01 和 2015-03-23 之间的日期范围报告 运行 太长然后我得到 this error
然后我 运行 在 Sql server management studio 中查询 运行 00:00:00 秒和 return 1814 行
这是我的查询
DECLARE @paramSdate AS DATE = (SELECT CAST('2014-01-01' AS DATE))
DECLARE @paramNdate AS DATE = (SELECT CAST('2015-03-23' AS DATE))
DECLARE @sdate AS DATE
,@edate AS DATE
SET @sdate = @paramSdate
SET @edate = @paramNdate
CREATE TABLE #tmp (x DATE,link INT)
WHILE @sdate <= @edate
BEGIN
INSERT INTO #tmp VALUES(@sdate,1)
SET @sdate = DATEADD(DAY,1,@sdate)
END
SELECT FORMAT(t.x,'dd/MM/yyyy','TH-th') AS [x]
,h.name
,ISNULL(cc.cnt,0) AS [cnt]
FROM #tmp t
LEFT JOIN (
SELECT 2 AS [type] , 'New Visit' AS [name] ,1 AS [link]
UNION
SELECT 3 AS [type] , 'Re-Visit' AS [name] ,1 AS [link]
UNION
SELECT 4 AS [type] , 'Book' AS [name] ,1 AS [link]
UNION
SELECT 5 AS [type] , 'Total' AS [name] , 1 AS [link]
) h ON t.link = h.link
LEFT JOIN (
SELECT COUNT(*) AS [cnt]
,CAST(v.new_contactdate AS DATE) AS [d]
,v.new_type
FROM [SCASSET_MSCRM].[dbo].[new_VisitHistory] v with(nolock)
WHERE v.new_type IN (2)
AND v.new_projectid IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND CAST(v.new_contactdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY v.new_type
,CAST(v.new_contactdate AS DATE)
UNION
SELECT COUNT(*) AS [cnt]
,CAST(v.new_contactdate AS DATE) AS [d]
,'3' AS [new_type]
FROM [SCASSET_MSCRM].[dbo].[new_VisitHistory] v with(nolock)
WHERE v.new_type IN (3,4)
AND v.new_projectid IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND CAST(v.new_contactdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY v.new_type
,CAST(v.new_contactdate AS DATE)
UNION
SELECT COUNT(*) AS [cnt]
,CAST(s.new_reservationdate AS DATE) AS [d]
,'4' AS [new_type]
FROM [SCAsset_MSCRM].[dbo].[new_salehistory] s with(nolock)
WHERE s.new_projectId IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND CAST(s.new_reservationdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY
CAST(s.new_reservationdate AS DATE)
UNION
SELECT COUNT(*) AS [cnt]
,CAST(v.new_contactdate AS DATE) AS [d]
,'5' AS [new_type]
FROM [SCAsset_MSCRM].[dbo].[new_VisitHistory] v with(nolock)
WHERE v.new_projectId IN ('CB2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D42115AC-633F-E411-80DD-F01FAFE5E7C0'
,'DE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'B92115AC-633F-E411-80DD-F01FAFE5E7C0'
,'032215AC-633F-E411-80DD-F01FAFE5E7C0'
,'EE2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EF2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'F02115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D32115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BD2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'BA2115AC-633F-E411-80DD-F01FAFE5E7C0'
,'D82115AC-633F-E411-80DD-F01FAFE5E7C0'
,'EB2115AC-633F-E411-80DD-F01FAFE5E7C0')
AND v.new_type IN (2,3,4)
AND CAST(v.new_contactdate AS DATE) BETWEEN @paramSdate AND @paramNdate
GROUP BY
CAST(v.new_contactdate AS DATE)
) cc ON cc.new_type = h.[type]
AND CAST(cc.d AS DATE) = CAST(t.x AS DATE)
ORDER BY t.x
OPTION(RECOMPILE)
DROP TABLE #tmp
这是我的 data set and report design
谢谢。
这可能是记录过多和您的报告 and/or 数据库超时的问题。我相信情况确实如此,因为当您将数据集限制为只有几条记录时,报告就会运行。
我会查看此资源以获取解决此问题的更多帮助。what is the default timeout processing option in SSRS Server