Darren Davies answered via SQL query to get the deadlocks in SQL SERVER 2008 – Stack Overflow a while ago listing a great SQL statement by Mladen Prajdić that shows how to do without the deprecated SP_LOCKS and SP_WHO2 (which is undocumented, and slightly different from SP_WHO) or the good old SP_LOCK2.
It is the textual equivalent of the Deadlock Graph, which is part of the SQL Server Profiler.
I like that profiler a lot (read this step-by-step intro if you haven’t used it), but some environments consider it too much power for a developer to use.
The SP_LOCKS documentation directs you to the sys.dm_tran_locks documentation, which is the base of the SQL below. It requires the mostly harmless VIEW SERVER STATE permission.
Finding out what to join in order to get some readable results suited for quick troubleshooting is quite an undertaking.
Mladen did all that, and this is his SQL: Read the rest of this entry »
Like this:
Like Loading...