03 September,2014 by Tom Collins
Question: A client is sending a query to a SQL Server . After 30 seconds a message appears on the SQL Server trace:
User error message : The statement has been terminated
If I run the code from SSMS, it completes successfully. Could you explain how I can fix this problem?
Answer: SQL Server runs queries with no timeout. The query timeout error is occurring on the client side. When a command exceeds the timeout duration, the client API sends an attention signal to SQL Server to cancel the executing query.
An example is the CommandTimeout property, defaulting to 30 seconds in ADO and ADO.NET.
If you have the Attention event added to the SQL Server trace, you’ll notice it appearing. In addition, the client API throws the timeout expired exception error message. You could recreate the message by executing the code from SSMS and hitting the cancel after 30 seconds
SQL Server – Troubleshooting the SQL Profiler trace Attention class event
SQL Server – How to troubleshoot query timeouts
SQL Server SLEEPING MODE , locks and transactions
What is SQL Server Query Tuning?
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |