<?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>Question Re: View containing data from multiple databases in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814112#M4844955</link>
    <description>&lt;P&gt;Hello Heinz,&lt;/P&gt;
&lt;P&gt;not sure if I got your question right, but if:
You may create a remote server entry for each of your DBs that is not local, and then a proxy table for each of these tables. It'll probably be helpful to use a different owner for each remote user which will allow you to use identical sets of proxy user names. Finally, you create a view unioning (UNION ALL) the proxy tables (and a local table, if required). It's probably a good idea to add a column with a literal value unique to each branch of the union indicating the origin / physical location of the rows.&lt;BR /&gt;
However, the optimizer's capabilities to optimize queries with non-trivial restrictions against such a view may be limited. You may have to use stored procedures with a result set as wrappers in cases where this causes problems.  &lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Volker&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2019 12:31:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2019-05-10T12:31:52Z</dc:date>
    <item>
      <title>View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaq-p/13814111</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;In a 3rd party integration szenario I have the following challenge:&lt;/P&gt;
&lt;P&gt;On 1 Sybase server, there are 3 ERP companies stored in 3 dbs. The table structures on these 3 dbs are 100% identical.
In my application I would like to show data from all 3 companies together in 1 view. Let's say, I want to see addresses from all 3 companies.&lt;/P&gt;
&lt;P&gt;Is there a way to create a view containing data from more than 1 db (meaning from more than 1 company)?&lt;/P&gt;
&lt;P&gt;Tanks in advance, your help is greatly appreciated.
Heinz&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 09:25:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaq-p/13814111</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-10T09:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814112#M4844955</link>
      <description>&lt;P&gt;Hello Heinz,&lt;/P&gt;
&lt;P&gt;not sure if I got your question right, but if:
You may create a remote server entry for each of your DBs that is not local, and then a proxy table for each of these tables. It'll probably be helpful to use a different owner for each remote user which will allow you to use identical sets of proxy user names. Finally, you create a view unioning (UNION ALL) the proxy tables (and a local table, if required). It's probably a good idea to add a column with a literal value unique to each branch of the union indicating the origin / physical location of the rows.&lt;BR /&gt;
However, the optimizer's capabilities to optimize queries with non-trivial restrictions against such a view may be limited. You may have to use stored procedures with a result set as wrappers in cases where this causes problems.  &lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Volker&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 12:31:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814112#M4844955</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-10T12:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814114#M4844957</link>
      <description>&lt;P&gt;Hi Volker
Thank you for your answer. I probably don't have too many administrative rights on that Sybase server. If I got your answer right, there is nothing like "just a view" containing the rows of all companies? The DBs are all local on the same machine in the same database engine (in sql server this would equal to "in the same instance"). So maybe or should I say hopefully no need for remote servers?
And yes, I this works, I will add a column as an indicator per row.
Thanks much for clarifying.
Heinz&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 13:42:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814114#M4844957</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-10T13:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814115#M4844958</link>
      <description>&lt;P&gt;That's one probably the most fundamental difference between SQL Anywhere and MSSQL (or ASE). You connect to a single database, not to a server. Connectionwise, databases on the same server are just as separate as they would be on different servers. At the same time, you don't need administrative rights on the server, but the specific rights to create proxy objects in the database holding them plus credentials for the database you try to access via proxy.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Volker&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 14:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814115#M4844958</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-10T14:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814116#M4844959</link>
      <description>&lt;P&gt;Ouch, seems to be my misconception ;-(&lt;/P&gt;
&lt;P&gt;When reading about possible solutions, I found this post on Stackoverflow.
&lt;A href="https://stackoverflow.com/questions/31113458/how-to-join-tables-in-different-database-on-the-same-sybase-server"&gt;https://stackoverflow.com/questions/31113458/how-to-join-tables-in-different-database-on-the-same-sybase-server&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Made me thinking it should be possible to just change the DB within the same connection.
Just out of curiosity:
Whats going on in the following snippet? Do they change the DB anyway, or do I misundertand the Term DB?&lt;/P&gt;
&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;/SPAN&gt;select tabA.*,tabC.* from DatabaseB..TableA tabA, DatabaseA..TableC tabC where tabA.xxx = tabC.xxx
&lt;/PRE&gt;&lt;/DIV&gt;


&lt;P&gt;Thanks again to bring some light into it. Very appreciated
Heinz&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 15:53:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814116#M4844959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-10T15:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814117#M4844960</link>
      <description>&lt;P&gt;The Stackoverflow is about SAP (formerly Sybase) Adaptive Server Enterprise aka ASE. If you're using ASE, it works precisely like that, but it would mean that you're asking in the wrong forum. If you're using SAP (formerly Sybase) SQL Anywhere, you're in the right place here, but the Stackoverflow post doesn't match your environment.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Volker&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 16:08:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814117#M4844960</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-10T16:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814118#M4844961</link>
      <description>&lt;P&gt;Just to add to ASE: If you are familiar with MS SQL, ASE is in many respects rather similar because both share a common origin...&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 19:46:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814118#M4844961</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2019-05-10T19:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814119#M4844962</link>
      <description>&lt;P&gt;I was not aware about the difference between this 2 products. But a least, I'm in the right forum here.
Thanks for sharing your knownledge!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 02:32:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814119#M4844962</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-13T02:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: View containing data from multiple databases</title>
      <link>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814113#M4844956</link>
      <description>&lt;P&gt;Here are some more questions with samples how to access tables from other SQL Anywhere databases:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://sqlanywhere-forum.sap.com/questions/19415"&gt;Grant select to another database/schema&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://sqlanywhere-forum.sap.com/questions/18145"&gt;Query over two SQL Anywhere 12 databases&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I'm sure there are several more tagged woth "remote-data-access" or "proxy-tables".&lt;/P&gt;
&lt;P&gt;As to the UNION ALL statement: In case performace suffers (this is sometimes a problem with remote data), it's a common strategy to copy remote data to the "local" database, say to a (possibly local temporary table) via INSERT ... SELECT FROM myProxyTable, and then to run the UNION ALL on the local copy.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 04:40:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/view-containing-data-from-multiple-databases/qaa-p/13814113#M4844956</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2019-05-13T04:40:06Z</dc:date>
    </item>
  </channel>
</rss>

