Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

timeout expired

Posted on 2008-06-10
6
Medium Priority
?
304 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

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

Accepted Solution

by:
chapmandew earned 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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 ?
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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…
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.

661 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