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

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Statements

FOR statement Next Page

FORWARD TO statement


Use this statement to send native syntax SQL statements to a remote server.

Syntax 1

FORWARD TO server-name sql-statement

Syntax 2

FORWARD TO [ server-name ]

Remarks

The FORWARD TO statement enables users to specify the server to which a passthrough connection is required. The statement can be used in two ways:

When establishing a connection to server-name on behalf of the user, the database server uses one of the following:

If the connection cannot be made to the server specified, the reason is contained in a message returned to the user.

After statements are passed to the requested server, any results are converted into a form that can be recognized by the client program.

server-name    The name of the remote server.

SQL-statement    A command in the native SQL syntax of the remote server. The command or group of commands is enclosed in curly brackets ({}) or single quotes.

Note

The FORWARD TO statement is a server directive and cannot be used in stored procedures, triggers, events, or batches.

Permissions

None

Side effects

The remote connection is set to AUTOCOMMIT (unchained) mode for the duration of the FORWARD TO session. Any work that was pending prior to the FORWARD TO statement is automatically committed.

Example

The following example sends a SQL statement to the remote server RemoteASE:

FORWARD TO RemoteASE { SELECT * FROM titles }

The following example shows a passthrough session with the remote server aseprod:

FORWARD TO aseprod
  SELECT * FROM titles
      SELECT * FROM authors
FORWARD TO;
Standards and compatibility