title: How to get SCHEMA.TABLES from another database?
body: <p>I want to get a list of tables exist in another database. for example if i have connected <strong>DB1</strong> database and i want to get a list of tables from <strong>DB2</strong> then how is it possible?</p>
  
  <p><em>I know there are some another approaches like connect <strong>DB2</strong> and execute insert query to insert schema into <strong>#temp</strong> table then connect <strong>DB1</strong> using <code>USE [DB1]</code> statement and use that <strong>#temp</strong> table.</em></p>
  
  <p>But, I don't want to change my sql connection at runtime. Because, there are some dependencies i have created on my sql connection. </p>
  
  <p><strong>UPDATED:</strong></p>
  
  <p>Database can be restored in same server. Now i am using following query to get Table List from the database.</p>
  
  <pre><code>SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
  </code></pre>
  
  <p>version of sql server is 2005.</p>