You can execute stored procedures on a remote Adaptive Server. The results from the stored procedure appear 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 include both 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 about configuring Adaptive Server for remote access. A remote server name (GATEWAY in the previous example) must match a server name in your local Adaptive Server interfaces file. If the server name in interfaces is in uppercase letters, you must also use uppercase letters in the RPC to match the server name.