Joins between tables from multiple local databases

A SAP Sybase IQ server may have several local databases running at one time. By defining tables in other local SAP Sybase IQ databases as remote tables, you can perform cross-database joins.

Example

Suppose you are using database db1, and you want to access data in tables in database db2. You need to set up proxy table definitions that point to the tables in database db2. For example, on a SAP Sybase IQ server named RemoteSA, you might have three databases available: db1, db2, and db3.

  1. If you are using ODBC, create an ODBC data source name for each database you will be accessing.

  2. Connect to the database from which you will be performing the join. For example, connect to db1.

  3. Perform a CREATE SERVER statement for each other local database you will be accessing. This sets up a loopback connection to your SAP Sybase IQ server.

    CREATE SERVER remote_db2
    CLASS 'SAODBC'
    USING 'RemoteSA_db2';
    CREATE SERVER remote_db3
    CLASS 'SAODBC'
    USING 'RemoteSA_db3';
  4. Create proxy table definitions by executing CREATE EXISTING TABLE statements for the tables in the other databases you want to access.

    CREATE EXISTING TABLE Employees
    AT 'remote_db2...Employees';