I have a DELETE
command that times out when I run it from my application. To investigate I put the same command in SQL Server Management Studio and it executed immediately. Can anybody point me in the right direction to find the cause of the delay?
In SQL Server Management Studio I typed:
DECLARE @docid INT;
SET @docid = 41;
DELETE FROM reports WHERE doc_id=@docid;
The reports table only has 5 rows, 1 of which has a docid of 41.
The reports table is pretty simple:
CREATE TABLE [dbo].[reports](
[doc_id] [int] NULL,
[candidate_id] [int] NULL,
[report] [varbinary](max) NOT NULL,
[ext] [nvarchar](10) NULL
with some constraints on both ids.
Some more info:
- If I delete from other tables in the same place it's quite happy.
- The connection is to a local instance on the same machine.
This is the exception I get when executing from within my application:
{System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()