The names of all replication definitions, including function replication definitions, must be unique in the replication system.
When you create an applied function replication definition for a primary function in your replication system, make sure that the function does not have an existing function replication definition that satisfies both these conditions:
The function replication definition is created using the create function replication definition command.
The function replication definition is used for the request function replication without subscription in Replication Server 15.0.1 and earlier version.
Otherwise, the existing request function replication will be disabled. See Appendix C, “Pre-15.1 Request Function Replication” in the Replication Server Administration Guide Volume 2.
Replication Server does not support nested transactions—those containing begin or commit statements—within replicated stored procedures.
If stored procedures with nested stored procedures are marked for replication:
The RepAgent forwards only the outer stored procedure call to the Replication Server.
The RepAgent shuts down.
An error message appears in the Adaptive Server error log.
When the maint_user or the replicate database replicates a stored procedure, using sp_setrepproc or sp_setreplicate, Adaptive Server always executes the stored procedure within a transaction. Even if you have not explicitly executed the replicated stored procedure within a transaction at the primary database, Adaptive Server places an implicit begin transaction at the start of the procedure when it is applied by the maint_user in the replicate database.
For more information, see dsi_max_xacts_in_group, in “Connection parameters that affect performance” on page 150 in the Replication Server Administration Guide Volume 2. If the replicated stored procedure contains such commands as begin transaction, commit transaction, or rollback transaction, errors may result when you execute the procedure. For example, a rollback transaction command might roll back to the start of the transaction group, rather than to the nested begin transaction command that was the intended rollback point.
Replicated functions, like Adaptive Server stored procedures, cannot contain parameters with text and image datatypes. Refer to the Adaptive Server Enterprise Reference Manual.
Adaptive Server logs a replicated stored procedure invocation in the database in which the enclosing transaction was started:
If the user does not begin a transaction explicitly, Adaptive Server begins one in the user’s current database before the stored procedure is invoked.
If the user begins the transaction in one database and then executes a replicated stored procedure in another database, the execution is still logged in the database where the transaction began.
If a single transaction invokes one or more request functions and executes applied functions or contains data modification language, or a mixed-mode transaction, Replication Server processes the request functions after all the other operations have completed, together in a separate transaction.
When you use replicated functions and heterogeneous datatype translations:
You cannot alter the datatype of a parameter value using create applied/request function replication definition or alter applied/request function replication definition. However, you can use datatype definitions to declare parameters for applied function replication definitions, which are then subject to class-level translations.
Replication Server does not perform translations on parameter values for request functions. However, during function-string mapping, the delimiters defined for the parameter values of their declared datatype are used to generate the SQL.
WARNING! Do not put a commit statement inside a replicated function as this may cause a duplicate key and make Replication Server recovery fail.