You can execute stored procedures on a remote Adaptive Server. The results from the stored procedure display on the terminal that calls the procedure. The syntax for identifying a remote server and the stored procedure is:
[execute] server.[database].[owner].procedure_name
You can omit the execute keyword when the remote procedure call (RPC) is the first statement in a batch. If other SQL statements precede the RPC, you must use execute or exec. You must give the server name and the stored procedure name. If you omit the database name, Adaptive Server looks for procedure_name in your default database. If you give the database name, you must also give the procedure owner’s name, unless you own the procedure or the procedure is owned by the Database Owner.
The following statements execute the stored procedure byroyalty in the pubs2 database located on the GATEWAY server:
Statement |
Notes |
---|---|
|
byroyalty is owned by the Database Owner. |
|
Use if pubs2 is the default database. |
|
Use when the statement is not the first statement in a batch. |
See Chapter 15, “Managing Remote Servers,” in the System Administration Guide: Volume 1 for information on setting up Adaptive Server for remote access. A remote server name (GATEWAY in the previous example) must match a server name in your local Adaptive Server’s interfaces file. If the server name in interfaces is in uppercase letters, you must also use uppercase letters in the RPC.