Executing procedures remotely

You can execute procedures on a remote Adaptive Server from your local Adaptive Server. Once both servers are properly configured, you can execute any procedure on the remote Adaptive Server simply by using the server name as part of the identifier. For example, to execute a procedure named remoteproc on a server named GATEWAY:

exec gateway.remotedb.dbo.remoteproc 

The following examples execute the procedure namelist in the pubs2 database on the GATEWAY server:

execute gateway.pubs2..namelist 
gateway.pubs2.dbo.namelist 
exec gateway...namelist 

The last example works only if pubs2 is your default database.

See Chapter 15, “Managing Remote Servers,” in the System Administration Guide: Volume 1. You can pass one or more values as parameters to a remote procedure from the batch or procedure that contains the execute statement for the remote procedure. Results from the remote Adaptive Server appear on your local terminal.

Use the return status from procedures to capture and transmit information messages about the execution status of your procedures. See “Return status”.

WARNING! If Component Integration Services is not enabled, Adaptive Server does not treat remote procedure calls (RPCs) as part of a transaction. Therefore, if you execute an RPC as part of a transaction, and then roll back the transaction, Adaptive Server does not roll back any changes made by the RPC. When Component Integration Services is enabled, use set transactional rpc and set cis rpc handling to use transactional RPCs. See the Reference Manual: Commands.