Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
iamgq
Starting Member
2 Posts |
Posted - 2005-10-26 : 04:14:38
|
| Hi, My site has developed a intermediate timeout problem. System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.Can someone tell me what could cause this intermediate problem. Is it something wrong with the query? It is definitely the problem from the query as I have 2 queries using same design and both of them develop similar problem. Pleaee help as our site will have major advertising next month so need to fix it by then. My server is running Win2003 on SQL 2000. I have shown the cut-down version of the original query:CREATE PROCEDURE dbo.sp_getmyitems(@CurrentPage tinyint,@PageSize int,@TotalRecords int OUTPUT)AsSet NoCount ONDeclare @FirstRec intDeclare @LastRec intSet @FirstRec = (@CurrentPage - 1) * @PageSizeSet @LastRec = (@CurrentPage * @PageSize + 1)Create Table #TempTable(LocalItemID int IDENTITY PRIMARY KEY,ItemID int,Title varchar(250),)Insert Into #TempTable(ItemID,Title)SELECT ItemID, TitleFROM tbl_ItemsSelect ItemID,TitleFrom #TempTableWhere LocalItemID > @FirstRec AND LocalItemID < @LastRecSelect @TotalRecords = Count(*) FROM #TempTableGOThank you |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2005-10-26 : 05:41:58
|
| Hi,If I am not wrong, you using this stored procedure for pagination of records. I think here the table you trying to access is getting locked by some other process. You can specify NO_LOCK in the statement you using to populate the #table.So in case the table is locked, you can still read the table. Insert Into #TempTable(ItemID,Title)SELECT ItemID, Title WITH (NOLOCK)FROM tbl_ItemsFor more inforation about NOLOCK, please check BOL.One of the good linl I found is http://www.developerfusion.co.uk/show/1688/4/.RegardsSachin Samuel |
 |
|
|
iamgq
Starting Member
2 Posts |
Posted - 2005-10-26 : 06:25:36
|
Hi Sachin,I will try to add (NOLOCK) into the query and see if it will fix the problem.Your info are very much appreciated.Regards,Paulquote: Originally posted by sachinsamuel Hi,If I am not wrong, you using this stored procedure for pagination of records. I think here the table you trying to access is getting locked by some other process. You can specify NO_LOCK in the statement you using to populate the #table.So in case the table is locked, you can still read the table. Insert Into #TempTable(ItemID,Title)SELECT ItemID, Title WITH (NOLOCK)FROM tbl_ItemsFor more inforation about NOLOCK, please check BOL.One of the good linl I found is http://www.developerfusion.co.uk/show/1688/4/.RegardsSachin Samuel
|
 |
|
|
|
|
|
|
|