I'm trying to find SQL statements that timed out using the SQL 2005 profiler. Is there a way to set such a filter?
3 Answers
In Profiler, you can add the event "Attention" under "Errors and Warnings". It's definition is
Collects all attention events, such as client interrupt request or when a client connection is broken.
As far as other errors (deadlocks, contraints, etc), try "Execution Warning" (reports warning that occurred during the execution of SQL statement or procedure) or "User Error Message" (the error message displayed to the user in the case of an error or exception).

- 1,836
- 15
- 19
-
+1. ALso, if the timeout is due to a dealock, collect the deadlock graph event. – Mitch Wheat Jan 24 '09 at 01:06
Yes.
- Check "All Events"
- Go to the lock section
- Specify the "lock: Timeout" events
Now, this works with server side locks (@@LOCK_TIMEOUT <> 0). I don't know if a client side timeout will be trapped.

- 422,506
- 82
- 585
- 676
-
3This will only catch timeouts caused by locking. Long running queries timed out by the calling application will not necessarily have locking issues. – jons911 Nov 11 '08 at 15:15
One option, if you know what your client configured timeouts are set to (ie. 30 seconds by default), you can set a filter on your trace to only collect events with a duration greater than or equal to your timeout (minus a second or two).

- 5,029
- 3
- 28
- 36
-
For those after me: Events Selection => Column Filters => Duration => Greater than or equal – Boris Callens Apr 18 '13 at 08:12