More Dynamic Management Views: sys.dm_tran_locks
I'm working on the chapter on blocking in the new book. Explaining blocking of course means explaining locks. Prior to 2005, to understand locks, you went to sp_lock. Not anymore. Now you can query sys.dm_tran_locks. It's so much more sophisticated than the old system procedure. Best of all, the information within it is simply a view into the internal locking infrastructure, so you're not placing extra load or extra processing on the system to marshal this data. A simple query to get basic locking information would look like this:  SELECT tl.request_session_id            ,tl.resource_database_id            ,tl.resource_associated_entity_id            ,tl.resource_type            ,tl.resource_description            ,tl.request_mode            ,tl.request_status  FROM sys.dm_tran_locks tl That just outputs roughly the same information as sp_lock. Lots more detail, not available in sp_lock, is available if you need it. Things…