title: Create view across multiple databases
body: <p>I have two databases; 1 is a live database for daily data input and the other is an archival DB for older data.</p>
  
  <p>How can I create a view which gets data from both databases?</p>
  
  <p>Three tables are involve... <code>database1.dbo.table</code> and <code>database1.dbo.tran1</code> in same database, and <code>database_archived.dbo.table1</code>:</p>
  
  <pre><code>Create VIEW [dbo].[VW_Table_ALL] 
  AS 
    SELECT * FROM database1.dbo.table1 
    UNION ALL 
    SELECT * FROM database_archived.dbo.table1 as Data INNER JOIN 
                  database1.dbo.tran1 as Tran ON Data.Tran_id = Tran.Tran_Id 
  
  GO
  </code></pre>