|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Timeout ASP0113 Error
Hi All,
I have an ASP application which is parameter driven. The query below is generated for one of the reports. If the user selects a small subset of records i.e the WHERE has another clause, the results are returned within a matter of seconds. However, if the user wants ALL records within the dates - as given by the query below, I get a timeout error. Is there another/better way to write this query? Here is the SQL statement: SELECT left(ExportData.dbo.tblWeeklySales.wsrCusNum,5) AS AccountNo, ExportData.dbo.tblWeeklySales.wsrCusName as Client , SUM ( CASE WHEN DATEPART(yy,ExportData.dbo.tblWeeklySales.wsrWERun) = 2002 THEN ExportData.dbo.tblWeeklySales.wsrSales ELSE 0 END) AS Turnover2002, SUM ( CASE WHEN DATEPART(yy,ExportData.dbo.tblWeeklySales.wsrWERun) = 2003 THEN ExportData.dbo.tblWeeklySales.wsrSales ELSE 0 END ) AS Turnover2003, SUM ( CASE WHEN DATEPART(yy,ExportData.dbo.tblWeeklySales.wsrWERun) = 2002 then ExportData.dbo.tblWeeklySales.wsrProfit ELSE 0 END) AS Profit2002, SUM ( CASE WHEN DATEPART(yy,ExportData.dbo.tblWeeklySales.wsrWERun) = 2003 then ExportData.dbo.tblWeeklySales.wsrProfit ELSE 0 END) AS Profit2003 FROM UserID2.dbo.tblBranch INNER JOIN ExportData.dbo.tblWeeklySales ON RIGHT(USERID2.dbo.tblBranch.brnBranchNumber, 3) = RIGHT(ExportData.dbo.tblWeeklySales.wsrCusBrn, 3) WHERE (DatePart(m,ExportData.dbo.tblWeeklySales.wsrWERun) >= 1 AND DatePart(m,ExportData.dbo.tblWeeklySales.wsrWERun) <= 1)AND (DATEPART(yy,ExportData.dbo.tblWeeklySales.wsrWERun) < = 2003)AND (DATEPART(yy,ExportData.dbo.tblWeeklySales.wsrWERun) > = 2002)GROUP BY left(ExportData.dbo.tblWeeklySales.wsrCusNum,5), ExportData.dbo.tblWeeklySales.wsrCusName ORDER BY left(ExportData.dbo.tblWeeklySales.wsrCusNum,5) asc TIA Jackie |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Timeout ASP0113 Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|