Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / March 2008

Tip: Looking for answers? Try searching our database.

SQL2000 Timeout on insert:  selecting all rows from table seems to

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Darrel - 24 Mar 2008 18:04 GMT
Summary:  We have been getting a reoccuring time out error when running a
single one line insert into a table. The timeout occurs until we run select *
from the table. This is for SQL Server 2000.  
___________________________

We have been getting a reoccuring time out error on an insert statement.  
The insert inserts a single row into a table.  We will call this table
'table1'  Once the timeout error starts occuring any insert  into the table
will timeout. This is regardless if it is the code from inside the asp.net
app,  or if it an insert into the table is run from inside table analyzer.  
The timeout keeps occuring until from inside query analyzer we run the query
'select * from table1'.  This then fixes the issue and all inserts start
working again for a few months. After a few months the timeouts start
occuring again, until we rerun that select statement.

The only operation that we do to table1 is inserting a single row, and
reads. NO explicit locks or transactions are applied to the table.  But it
seems that either some sort of deadlock keeps happening, or an index
corruption is occuring.

Can anyone tell me why this error keeps occuring, and what can we do to
esure that this issue does not occur again? Is this a lock issue, or an index
issue? Is it some problem with the code, or a bug in SQL Server?

I have below the code that was used inside of the stored procedure, (note  
the column,table and variable names changed are changed from the original).
This procedure is the only place that any update operation is done to
'table1' at all. Anything else is merely reads.

CREATE PROCEDURE dbo.DoInsert
AS
declare @gid as varchar(50)
declare @id as integer
set @gid=newID()
set nocount on
 Insert into table1(gid, startTime) values (@gid, getdate())
 set @id=scope_identity() --as identityInsert
set nocount off
  select @gid as 'gid', @id as 'id'
Tibor Karaszi - 24 Mar 2008 19:08 GMT
The first step I would take is to look into blocking. Using things like sp_who, sp_who2, sp_lock,
sysprocesses, syslockinfo etc.

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

> Summary:  We have been getting a reoccuring time out error when running a
> single one line insert into a table. The timeout occurs until we run select *
[quoted text clipped - 35 lines]
> set nocount off
>   select @gid as 'gid', @id as 'id'
Andy Reilly - 25 Mar 2008 23:55 GMT
Could this be anything to do with stats on this table ???  Are your stats
auto generated?

Andy
> The first step I would take is to look into blocking. Using things like
> sp_who, sp_who2, sp_lock, sysprocesses, syslockinfo etc.
[quoted text clipped - 46 lines]
>> set nocount off
>>   select @gid as 'gid', @id as 'id'
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.