title: SQL Server 2008 R2 DMV - sys.dm_sql_referencing_entities - query usage
body: <p>I am trying to get all dependencies for a list of tables using the <code>sys.dm_sql_referencing_entities</code> DMV.</p>
  
  <p>This query gives me the list of all tables:  </p>
  
  <pre><code>SELECT TableName from FinalTableList;  
  </code></pre>
  
  <p>This query gives the dependencies for TableA:  </p>
  
  <pre><code>SELECT  referencing_entity_name
  FROM sys.dm_sql_referencing_entities ('dbo.TableA', 'OBJECT') ;  
  </code></pre>
  
  <p>I would like to combine the above 2 in a query or procedure so that I can get all dependencies in the following format:  </p>
  
  <pre><code>TableA  Dependency1
          Dependency2
          Dependency3
  TableB  Dependency1
          Dependency2
  ...................
  </code></pre>
  
  <p>How should the query be framed?  </p>