Adaptive Server uses the following method to determine in which database a replicated stored procedure execution will be logged:
The procedure gets logged in the database in which the enclosing transaction was started.
If the user does not begin a transaction explicitly, Adaptive Server will begin one in the user’s current database before the stored procedure execution.
If the user begins the transaction in one database, and then executes a replicated stored procedure in another database, the execution will still be logged in the database where the user began the transaction.
If the execution of a table-style replicated stored procedure (marked for replication by using either sp_setreplicateproc_name, 'true' or sp_setrepprocproc_name, 'table') is logged in one database and changes replicated tables in another database, the table’s changes and the procedure execution are logged in different databases. Therefore, the effects of the stored procedure execution can be replicated twice. The first time the stored procedure execution itself is replicated. The second time table changes that have been logged in the other database are replicated.