title: SSRS How to do a cross database join without hardcoding the database name in the report query
body: <p>I have an SSRS report on that connects to two databases in its query.</p>
  
  <pre><code>SELECT table
  FROM MainDB1.DBO.Table AS table1
  JOIN MainDB2.DBO.Table AS table2 ON table1.ID = table2.ID
  </code></pre>
  
  <p>It is using an SSRS data-source to connect to its server. When I want to edit the report i have to do so on a separate server, this server has the same databases but they are named diffently.</p>
  
  <p>I have to manually edit the query to look like this in order for me to be able to change the report</p>
  
  <pre><code>SELECT table
  FROM DevDB1.DBO.Table AS table1
  JOIN DevDB2.DBO.Table AS table2 ON table1.ID = table2.ID
  </code></pre>
  
  <p>Each report server datasource is the same name and referenced in the report.</p>
  
  <p>Is there a way in the dataset to join these two databases? Or does anyone have their own way of handling this problem? It would make this process way more efficient.</p>
  
  <p>Thanks</p>