Question

I am experiencing a problem whereby executing a stored procedure to update a record in a table is resulting in a timeout error. I originally call my stored procedure from within an MVC3 application, which is where I first noticed the error.

However, using the SQL Server Profiler, I was able to copy the code that was generated by ADO.NET and run this directly on the database. I let this query run for approximately 5 minutes and it still didn't manage to return anything.

Here are a few facts:

  1. The stored procedure has approximately 100 arguments that are being passed to it.

  2. My MVC Application, SSMS and Sql Server 2008 are all installed on the same machine.

  3. The stored procedure attempts to update a single row in a table containing about 5000 entries.

  4. There was a trigger that would update the LastModifiedDate and CreatedDate, but I removed these triggers, and updated the EDMX to determine if there was an infinite loop caused by these triggers.

  5. Our live server runs exactly the same stored procedure (using classic asp) as the one I am trying to run and achieves the correct result. Furthermore, the live server fails to run the same stored procedure under .NET

  6. My machine fails to run the stored procedure for both the classic ASP and the ASP.NET

  7. The stored procedure seems to fail only for a few of the rows, and others work perfectly fine.

  8. I have tried changing the values of the parameters that are passed into the stored procedure

  9. Other stored procedures work fine

  10. There appears to be a lock on the particular table that the stored procedure was attempting to update, since executing other queries worked fine, even when waiting for this one to execute.

If anyone has any ideas on any other tests I could perform,or any tools I could use to determine the root cause of the timeout error.

Thanks.

P.S. Don't tell me to change the command timeout property, I have tried setting this to zero!

No correct solution

OTHER TIPS

I can think of two things :

  1. I assume you have already implemented exception handling in the stored procedure. If not, please do so, and try to get hold of the problem statement first. When you say, it happens for some rows, it might be due to bad data ? Read this for information on how to do exception handling in SQL Server 2008

  2. Have your tried finding out whether there is a dead-lock ? Please read this for detailed procedure and understanding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top