sp_passthru

Description

Component Integration Services only Allows the user to pass a SQL command buffer to a remote server.

Syntax

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

Parameters

server

is the name of a remote server to which the SQL command buffer will be passed. The class of this server must be a supported, non-local server class.

command

is the SQL command buffer. It can hold up to 255 characters.

errcode

is the error code returned by the remote server, if any. If no error occurred at the remote server, the value returned is 0.

errmsg

is the error message returned by the remote server. It can hold up to 255 characters. This parameter is set only if errcode is a nonzero number; otherwise NULL is returned.

rowcount

is the number of rows affected by the last command in the command buffer. If the command was an insert, delete, or update, this value represents the number of rows affected even though none were returned. If the last command was a query, this value represents the number of rows returned from the external server.

arg1argn

receives the results from the last row returned by the last command in the command buffer. You can specify up to 250 arg parameters. All must be declared as output parameters.

Examples

Example 1

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 will be set to 1:

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

Usage


Return Parameters

Permissions

Any user can execute sp_passthru.

See also

System procedures sp_autoconnect, sp_remotesql