Show TOC

rs_beginLocate this document in the navigation structure

Begins a transaction in a data server.

Examples
Example 1

Creates an rs_begin function string for the <oth_sql_class> function-string class. The <rs_origin_xact_name> system variable has a null value if the transaction has no name. Placing “t_” in front of the system variable prevents data server syntax errors and allows the function string to support named and unnamed transactions.

alter function string rs_begin
 for oth_sql_class
 output language
 'begin transaction
   t_?rs_origin_xact_name!sys_raw?'
Example 2

Creates an rs_begin function string for a function-string class for a data server that does not support the begin transaction operation.

create function string rs_begin
 for oth_sql_class
 output language ''
Usage
  • The rs_begin function has function-string-class scope.

  • Replication Server creates an initial rs_begin function string for the system-provided function-string classes during installation.

  • If you use a user-created base function-string class, you must create an rs_begin function string.

  • Create or customize an rs_begin function string at the Replication Server that is the primary site for the class.

  • Some data servers do not support an explicit begin transaction operation. Instead, they begin transactions implicitly whenever the previous transaction is committed or rolled back. For these data servers, the rs_begin function string can be an empty string ('').

  • The function string for this function usually uses the <rs_origin_xact_name> system variable. Its value is received from the RepAgent. The transaction name is assigned in Transact-SQL with begin transaction.