title: How to find out what table a page lock belongs to
body: <p>I'm using the <code>sys.dm_tran_locks</code> view to check what areas of my database have locks when we are having performance problems.</p>
  
  <p>Using this view....</p>
  
  <ul>
  <li><p>If the resource_type is <strong>database</strong> I can use the DB_NAME function to find out what database has the lock. </p></li>
  <li><p>If its an <strong>object</strong> I can normally join to sys.tables to check what table it is. </p></li>
  </ul>
  
  <p>However if the resource_type is <strong>Page</strong> or <strong>Key</strong> is there any way to trace this back to its parent table so I can get a good idea of which tables are locking?</p>