Solved

timeout expired

Posted on 2008-06-10
6
297 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
  • 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
script to send html report 3 30
Webservices in T-SQL 3 30
sql server computed columns 11 29
Whats wrong in this query - Select * from tableA,tableA 11 28
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now