Transactional RPCs

The server allows RPCs to be included within the unit of work initiated by the current transaction.

Before using transactional RPCs, issue the set transactional_rpc on or set cis_rpc_handling on command.

Assuming that the remote server can support the inclusion of RPCs within transactions, the following syntax shows how this capability might be used:

begin transaction
 insert into t1 values (1)
 update t2 set c1 = 10
 execute @status = RMTSERVER.pubs2.dbo.myproc
 if @status = 1
 	commit transaction
 else
 	rollback transaction

In this example, the work performed by the procedure myproc in server RMTSERVER is included in the unit of work that began with the begin transaction command. This example requires that the remote procedure myproc return a status of “1” for success. The application controls whether the work is committed or rolled back as a complete unit.

The server that is to receive the RPC must allow RPCs to be included in the same transactional context as Data Manipulation Language (DML) commands (select, insert, delete, update). This is true for Adaptive Server and is expected to be true for most DirectConnect products being released by Sybase. However, some database management systems may not support this capability.