I have a query that times out after about 20 seconds. I am not a DBA so that may be part of the problem. Here is the SQL that I pass to a COM object:
Select eh.EvaluatorID as id,
(select fullName from vwEmployeefull as vw where vw.TimekeeperID = Max(eh.Evaluatorid)) as Name,
(select EvalType from EvalSetup as es where es.EvalID = max(eh.Evalid)) as EvalName,
(select OfficeAbbr from vwEmployeeFull as vw where vw.timekeeperID = Max(eh.EvalueeID)) as Office,
(select Department from akDataTransfer.dbo.HRDepartment as hr where hr.DeptID = Max(eh.DepartmentID)) as Department,
(select count(*) from evalheader where evaluatorid = eh.evaluatorid and complete='Y' and evalid=53) as Complete,
(select count(*) from evalheader where evaluatorid = eh.evaluatorid and complete='I' and evalid=53) as InProgress,
(select count(*) from evalheader where evaluatorid = eh.evaluatorid and complete='N' and evalid=53) as NotStarted
from evalheader as eh, vwEmployeeFull as vw
where eh.evalid = 53 group by eh.EvaluatorID order by Name
It should return less than 1200 records.
Here is the VB code in the COM object that executes the query:
If Not getConnection(strErr) Then
GoTo ErrHdl
Else
cnn.Execute strSQL
dbNoReturnRecordset = True
End If
This all takes place in an ASP form. The data is displayed on the ASP page.
If I filter the data so that less records are returned everything works fine.
Any help would be appreciated.
TIA
Nate
Select eh.EvaluatorID as id,
(select fullName from vwEmployeefull as vw where vw.TimekeeperID = Max(eh.Evaluatorid)) as Name,
(select EvalType from EvalSetup as es where es.EvalID = max(eh.Evalid)) as EvalName,
(select OfficeAbbr from vwEmployeeFull as vw where vw.timekeeperID = Max(eh.EvalueeID)) as Office,
(select Department from akDataTransfer.dbo.HRDepartment as hr where hr.DeptID = Max(eh.DepartmentID)) as Department,
(select count(*) from evalheader where evaluatorid = eh.evaluatorid and complete='Y' and evalid=53) as Complete,
(select count(*) from evalheader where evaluatorid = eh.evaluatorid and complete='I' and evalid=53) as InProgress,
(select count(*) from evalheader where evaluatorid = eh.evaluatorid and complete='N' and evalid=53) as NotStarted
from evalheader as eh, vwEmployeeFull as vw
where eh.evalid = 53 group by eh.EvaluatorID order by Name
It should return less than 1200 records.
Here is the VB code in the COM object that executes the query:
If Not getConnection(strErr) Then
GoTo ErrHdl
Else
cnn.Execute strSQL
dbNoReturnRecordset = True
End If
This all takes place in an ASP form. The data is displayed on the ASP page.
If I filter the data so that less records are returned everything works fine.
Any help would be appreciated.
TIA
Nate