Mapping the remote tables to Adaptive Server

create existing table enables the definition of existing (proxy) tables. The syntax for this option is similar to the create table command and reads as follows:

create proxy_table
	table_name
	at “pathname”

When the server processes this command, it does not create a new table. Instead, it checks the table mapping and verifies the existence of the underlying object. If the object does not exist (either host data file or remote server object), the server rejects the command and returns an error message to the client.

After you define an existing table, issue an update statistics command for that table. This helps the query optimizer make intelligent choices regarding index selection and join order.

Example

To illustrate the remote Adaptive Server tables publishers and titles in the sample pubs2 database mapped to a local server, follow these steps:

Mapping the remote tables

The steps required to produce the mapping illustrated above are as follows:

  1. Define a server named SYBASE. Its server class is ASEnterprise, and its name in the interfaces file is SYBASE:

    exec sp_addserver SYBASE, ASEnterprise, SYBASE
    
  2. Define a remote login alias. This step is optional. User “sa” is known to remote server SYBASE as user “sa,” password “timothy”:

    exec sp_addexternlogin SYBASE, sa, sa, timothy
    
  3. Define the remote publishers table:

    create proxy_table publishers
    at "SYBASE.pubs2.dbo.publishers"
    
  4. Define the remote titles table:

    create proxy_table titles
    at "SYBASE.pubs2.dbo.titles"