sp_passthru

sp_passthru allows the user to pass a SQL command buffer to a remote server. The syntax of the SQL statements being passed is assumed to be the syntax native to the class of server receiving the buffer; no translation or interpretation is performed. Results from the remote server are optionally placed in output parameters. The syntax for sp_passthru follows:

sp_passthru server, command, errcode, errmsg, rowcount
 [, arg1, arg2, ... argn]

where:

Example

sp_passthru ORACLE, "select date from dual", @errcodeoutput, @errmsg output, @rowcount output, @oradate output

This example returns the date from the Oracle server in the output parameter @oradate. If an Oracle error occurs, the error code is placed in @errcode and the corresponding message is placed in @errmsg. The @rowcount parameter is set to 1.

For more information on sp_passthru and its return status, see the Reference Manual.