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 is:
sp_passthru server, command, errcode, errmsg, rowcount [, arg1, arg2, ... argn]
server is the name of the server that is to receive the SQL command buffer; the datatype is varchar(255).
command is the SQL command buffer; the datatype is varchar(255).
errcode is the error code returned by the remote server; the datatype is int output.
errmsg is the error message returned by the remote server; the datatype is varchar(1024) output.
rowcount is the number of rows affected by the last command in the command buffer; the datatype is int output.
arg1 – argn are optional parameters. If provided, these output parameters will receive the results from the last row returned by the last command in the command buffer. The datatypes may vary. All must be output parameters.
sp_passthru ORACLE, "select date from dual", @errcodeoutput, @errmsg output, @rowcount output, @oradate output