我用表值参数构建sql存储过程(作为传递给diq表的过滤器) 从diq表获取数据有超过15000000的记录 并保存按年龄组分组的女性和男性人数 另一张桌子(夏日表)
create proc SP_fillSmryAgeCohort
(
@psc as tempProcCode readonly,
@refc as tempRefCode readonly,
@relc as tempRelCode readonly,
@ethc as tempEthCode readonly,
@cntc as tempCntryCode readonly,
@fromDate datetime,
@toDate datetime
)
as
begin
SET nocount ON
declare @SQL NVARCHAR(1000)
declare @PscCount int
declare @refcCount int
declare @relcCount int
declare @ethcCount int
declare @cntcCount int
set @PscCount = (select COUNT(psc) from @psc)
set @refcCount = (select COUNT(refc) from @refc)
set @relcCount = (select COUNT(relc) from @relc)
set @ethcCount = (select COUNT(ethc) from @ethc)
set @cntcCount = (select COUNT(cntc) from @cntc)
delete from dbo.FilterSmryAgeCohort
SET @SQL = 'insert into FilterSmryAgeCohort
(cnt,sexcode,AgeCohortText) select count(distinct id)cnt,sexcode,AgeCohortText from diq
WHERE 1=1'
IF(@PscCount > 0)
BEGIN
SET @SQL = @SQL + 'AND diq.psc in (select psc from @psc )'
END
IF(@refcCount > 0)
BEGIN
SET @SQL = @SQL + 'AND diq.refc in (select refc from @refc )'
END
IF(@relcCount > 0)
BEGIN
SET @SQL = @SQL + 'AND diq.relc in (select relc from @relc )'
END
IF(@ethcCount > 0)
BEGIN
SET @SQL = @SQL + 'AND diq.ethc in (select ethc from @ethc )'
END
IF(@cntcCount > 0)
BEGIN
SET @SQL = @SQL + 'AND diq.cntc in (select cntc from @cntc )'
END
SET @SQL = @SQL + 'and diq.regdate>= @fromDate
and diq.regdate<= @toDate group by sexcode,AgeCohortText'
EXECUTE sp_executesql @SQL,
N'@psc tempProcCode READONLY , @refc tempRefCode READONLY , @relc tempRelCode READONLY ,
@ethc tempEthCode READONLY ,@cntc tempCntryCode READONLY ,@fromDate datetime ,@toDate datetime' ,
@psc, @refc , @relc , @ethc , @cntc , @fromDate , @toDate
end
go
我从我的MVC网络应用程序中调用它 使用实体框架6 exrtas package
我第一次从我的应用程序调用该过程成功完成 没有错误, 但是当我多次调用它时会导致Timeout过期异常
&#34;错误:超时已过期。操作完成之前经过的超时时间或服务器没有响应&#34;
我需要帮助才能获得有关此异常的更多信息以及原因 它,以及如何解决它?
thx:)