I have a SQL statement from my application. I’d like to know which locks that statement acquires; how can I do that with SQL server?
The statement has been involved in a deadlock, which I’m trying to analyze; I cannot reproduce the deadlock.
I’m running on MS SQL Server 2005.
I have a SQL statement from my application. I’d like to know which locks
Share
I would suggest that you turn on the Deadlock Detection Trace Flags in the first instance, rather than running a Profiler Trace indefinitely.
This way, the event details will be logged to the SQL Server Error Log.
Review the following Books Online reference for details of the various trace flags. You need to use 1204 and/or 1222
http://msdn.microsoft.com/en-us/library/ms188396(SQL.90).aspx
Be sure to enable the trace flags with server scope and not just the current session. For example use: