Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Remote data access » Proxy tables


Creating proxy tables (SQL)

You can create proxy tables in Interactive SQL using either the CREATE TABLE or CREATE EXISTING TABLE statement.


You must have the CREATE PROXY TABLE system privilege to create proxy tables owned by you. You must have the CREATE ANY TABLE or CREATE ANY OBJECT system privilege to create proxy tables owned by others.

Context and remarks

The CREATE TABLE statement creates a new table on the remote server, and defines the proxy table for that table when you use the AT clause. Columns are defined using SQL Anywhere data types. SQL Anywhere automatically converts the data into the remote server's native types.

If you use the CREATE TABLE statement to create both a local and remote table, and then subsequently use the DROP TABLE statement to drop the proxy table, the remote table is also dropped. You can, however, use the DROP TABLE statement to drop a proxy table created using the CREATE EXISTING TABLE statement. In this case, the remote table is not dropped.

The CREATE EXISTING TABLE statement creates a proxy table that maps to an existing table on the remote server. SQL Anywhere derives the column attributes and index information from the object at the remote location.

 Create a proxy table with the CREATE EXISTING TABLE statement
  1. Connect to the host database.

  2. Execute a CREATE EXISTING TABLE statement.


The proxy table is created.


To create a proxy table called p_Employees on the current server that maps to a remote table named Employees on the server named RemoteSA, use the following syntax:

AT 'RemoteSA..GROUPO.Employees';
A proxy table called p_Employees is on the local server, and is mapped to the Employees table on the RemoteSA server.

The following statement maps the proxy table a1 to the Microsoft Access file mydbfile.mdb. In this example, the AT clause uses the semicolon (;) as a delimiter. The server defined for Microsoft Access is named access.

AT 'access;d:\mydbfile.mdb;;a1';

The following statement creates a table named Employees on the remote server RemoteSA, and creates a proxy table named Members that maps to the remote table:

( membership_id INTEGER NOT NULL,
member_name CHAR( 30 ) NOT NULL,
office_held CHAR( 20 ) NULL )
AT 'RemoteSA..GROUPO.Employees';

 See also