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.
Figure A-1 illustrates the remote Adaptive Server tables publishers and titles in the sample pubs2 database mapped to a local server.
Figure A-1: Defining remote tables in a local server
The steps required to produce the mapping illustrated above are as follows:
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
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
Define the remote publishers table:
create proxy_table publishers at "SYBASE.pubs2.dbo.publishers"
Define the remote titles table:
create Proxy_table titles at "SYBASE.pubs2.dbo.titles"