I'm working on a multi-tenanted solution. As such we have a lot of databases on our SQL Server. I'm looking at a locking issue and need to be able to see which locks are being waited on.
I have queried the sys.dm_tran_locks dynamic view, but would like to also include the, database, object and index names referred to by the resource_associated_entity_id column. This links through to the sys.partitions table, but that table only returns rows for the current database and the locks I'm looking at are distributed around several databases.
Is there a way to get this information without creating a cursor and using dynamically generated queries?