Remote procedures as proxy tables

You can add an optional clause to the create existing table statement to indicate the remote object is actually a stored (or other) procedure instead of a table. Without this clause, the remote object is assumed to be a table or view:

create existing table t1
	(
				column_1     int,
				column_2     int
	)
	EXTERNAL PROCEDURE AT "SYBASE.mydb.dbo.p1"

If the remote object is type procedure, several processing differences occur:

If an object of the type procedure has been defined within the server, a query is not issued to the remote server on which the object resides. Instead, Component Integration Services issues an RPC and treats the results from the RPC as a read-only table.

Examples

create existing table rtable
 (	col1		int,
 	col2		datetime,
 	col3		varchar(30)
 )
external procedure at “SYBASE...myproc “

select * from rtable

When this query is issued, Component Integration Services sends the RPC named myproc to server SYBASE. Row results are treated like the results from any other table; they can be sorted, joined with other tables, grouped, inserted into another table, and so forth.

RPC parameters should represent arguments that restrict the result set. If the RPC is issued without parameters, the entire result set of the object is returned. If the RPC is issued with parameters, each parameter further limits the result set. For example:

select * from rtable where col1 = 10

results in a single parameter, named @col1, that is sent along with the RPC. Its value is 10.

Component Integration Services attempts to pass as many of the search arguments as possible to the remote server, but depending on the SQL statement being executed, Component Integration Services might perform the result set calculation itself. Each parameter represents a search for an exact match, for example, the = operator.

The following rules define the parameters sent to the RPC. If an RPC is used as a Component Integration Services object, you should keep these rules in mind during development.