Guidelines for creating function strings

The following guidelines for creating function strings pertain to function-string classes:

The following guidelines pertain to function strings themselves:

Refer to Chapter 3, “Replication Server Commands,” in the Replication Server Reference Manual for the complete syntax for the create function string command.

Example for rs_begin function string

The following example creates a function string for the rs_begin function that begins a transaction in the database by executing a stored procedure named begin_xact.

create function string rs_begin
 for gateway_func_class
 output rpc 'execute begin_xact'

Example for rs_insert function string

The following example creates a function string for a rs_insert function that references the publishers_rep replication definition, which executes an RPC at the replicate database as a result of an insert in the primary table. The stored procedure insert_publisher is defined only at the replicate database.

create function string publishers_rep.rs_insert
    for rs_sqlserver_function_class
    output rpc
    'execute insert_publisher
      @pub_id = ?pub_id!new?,
      @pub_name = ?pub_name!new?,
      @city = ?city!new?,
      @state = ?state!new?'