title: Query to get a Table Name based on its ID
body: <p>I have a table (DB_TableInfo) in my DB like the following</p>
  
  <pre><code>TableId         Type
  859374678        R
  579845658        B
  478625849        R
  741587469        E
  .
  .
  .
  </code></pre>
  
  <p>this table represents all tables in my DB. What I wanna do is to write a query to select tables of Type 'R', get their Id and return the Name of the table belonging to that Id (the TableName column is not available in the specified table)</p>
  
  <p>Can anybody help me out?</p>
  
  <p>I wanna write a query similar to this one!</p>
  
  <pre><code>SELECT TableID = OBJECT_NAME FROM [DB_TableInfo] WHERE Type = 'R' 
  </code></pre>