<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Multiple Databases in a dataset in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Multiple-Databases-in-a-dataset/m-p/1170405#M14683</link>
    <description>&lt;P&gt;You should be solve this more elegantly in SQL Server by using synonyms (see&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/sql/relational-databases/synonyms/create-synonyms?view=sql-server-ver15" target="_blank"&gt;https://docs.microsoft.com/en-us/sql/relational-databases/synonyms/create-synonyms?view=sql-server-ver15&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These effectively work as sort short cut links. I think if you setup linked servers you can event create cross-server synonyms, but you'd need to be careful with these as they come with the same perform potential performance issues as referencing linked servers directly. However using them to link across databases in the same instance is less prone to issues (and has the same performance implications as using 3 part names). We typically put all our synonyms in their own schemas with a prefix of syn_ so that we can easily see that we are not referencing a local object&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could do something like the following in TESTDB1 (notice that the reference to TESTDB2 is set once when you create the synonym)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;CREATE SYNONYM syn_db2.Sales FOR TESTDB2.dbo.Sales; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then your report just has to connect to TESTDB1 and could run the following query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Select D.DeptDescription, S.Amount&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;from Dept D join syn_db2.Sales S&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;on D.DeptCode = S.DeptCode&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jun 2020 04:10:24 GMT</pubDate>
    <dc:creator>d_gosbell</dc:creator>
    <dc:date>2020-06-19T04:10:24Z</dc:date>
    <item>
      <title>Multiple Databases in a dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Multiple-Databases-in-a-dataset/m-p/1168753#M14664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a requirement of fetching data from two databases for most of our SSRS related paginated reports. Creating a data source in the Report designer (Visual Studio) allows connection to be made to a single data source only (1 database). Is there a best practice approach/solution to this requirement other than the one we got? (Detail below)&lt;BR /&gt;&lt;BR /&gt;We did some research and figured out a way to deal with it, but it only works if the 2 databases reside on the same server. When writing the report queries, we can append the database name with the schema to reference the table we require. For example:&lt;BR /&gt;&lt;EM&gt;Select D.DeptDescription, S.Amount&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;from TESTDB1.dbo.Dept D join TESTDB2.dbo.Sales S &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;on D.DeptCode = S.DeptCode&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Using the above approach we face a different problem; related to migration. We have different DB names on Development and Production servers, meaning we can’t use the same query on Prod to get the same data&lt;BR /&gt;(Database in Prod might be LIVEDB1 and LIVEDB2).&lt;BR /&gt;So every time a report is deployed on Production the query will need to be modified. Is there a work around or a better/clean solution for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Thanks&lt;/P&gt;&lt;P&gt;Yaseen&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 11:56:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Multiple-Databases-in-a-dataset/m-p/1168753#M14664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-18T11:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Databases in a dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Multiple-Databases-in-a-dataset/m-p/1170405#M14683</link>
      <description>&lt;P&gt;You should be solve this more elegantly in SQL Server by using synonyms (see&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/sql/relational-databases/synonyms/create-synonyms?view=sql-server-ver15" target="_blank"&gt;https://docs.microsoft.com/en-us/sql/relational-databases/synonyms/create-synonyms?view=sql-server-ver15&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These effectively work as sort short cut links. I think if you setup linked servers you can event create cross-server synonyms, but you'd need to be careful with these as they come with the same perform potential performance issues as referencing linked servers directly. However using them to link across databases in the same instance is less prone to issues (and has the same performance implications as using 3 part names). We typically put all our synonyms in their own schemas with a prefix of syn_ so that we can easily see that we are not referencing a local object&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could do something like the following in TESTDB1 (notice that the reference to TESTDB2 is set once when you create the synonym)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;CREATE SYNONYM syn_db2.Sales FOR TESTDB2.dbo.Sales; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then your report just has to connect to TESTDB1 and could run the following query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Select D.DeptDescription, S.Amount&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;from Dept D join syn_db2.Sales S&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;on D.DeptCode = S.DeptCode&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 04:10:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Multiple-Databases-in-a-dataset/m-p/1170405#M14683</guid>
      <dc:creator>d_gosbell</dc:creator>
      <dc:date>2020-06-19T04:10:24Z</dc:date>
    </item>
  </channel>
</rss>

