Solved

timeout expired

Posted on 2008-06-10
6
299 Views
Last Modified: 2010-04-21
I get the following error because of a network issue we are having. We still havent figured out where the problem is. Here is the error:

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

I always get the error in the following stored procedure:

CREATE PROCEDURE spGetItemRackCounter
@fdRackType as int,
@fdItemOrderId as int,
@fdReturn1 int output
AS
Begin
      SELECT @fdReturn1 = Count(fdAssemblyBarcode)
      FROM tbStation5
      WHERE fdItemOrderId = @fdItemOrderId
      IF @fdReturn1 is null
      Select @fdReturn1 = 0
End
GO

I cant figure out why I get the error only when the program is accessing this stored proc but not the other stored procedures. I have about 20 stored procedures accessing tbStation5 table. And altogether about 60 stored procedures in this database. There are also 297772 records in tbStation5 table. What can I do to improve this stored procedure or table? If I add an index where should I add it to? Will that make things better?

Also the reason I say it is a network problem is because I get the error at certain times. Every day between 8:00 AM  9:00 AM and 12:00 PM 1:00 PM, and around 2:00 AM.
0
Comment
Question by:shamif
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 21752853
try this:

CREATE PROCEDURE spGetItemRackCounter
@fdRackType as int,
@fdItemOrderId as int,
@fdReturn1 int output
AS
Begin
      SELECT @fdReturn1 = Count(fdAssemblyBarcode)
      FROM tbStation5 with(nolock)
      WHERE fdItemOrderId = @fdItemOrderId
      IF @fdReturn1 is null
      Select @fdReturn1 = 0
End
GO
0
 

Author Comment

by:shamif
ID: 21761209
I put with (nolock) but I am still getting timeout errors. I don't see how nolock can fix the problem.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 21762071
Do you have an index on the fdItemOrderId  field?
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:shamif
ID: 21762129
no I don't
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 125 total points
ID: 21762181
You definetly want one on there if you're searching through a lot of records....it may not fix everything, but it is going to help.

create nonclustered index tbStation4_OrderID on tbStation5(fdItemOrderId)
0
 

Author Closing Comment

by:shamif
ID: 31465812
Putting an index helped. The timeout error went to different stored procedure. I think we have to fix the root of the problem. But thank you for your help.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question