Creating a Function Replication Definition

Create a function replication definition.

  1. Record this information on your worksheet:
    • Primary data server name (line 3.k)

    • Primary database name (line 3.j)

    • Procedure and parameter names

  2. Create the function replication definition:
    create function replication definition <replication_definition_name> 
    with primary at <dataserver>.<database>
    deliver as '<procedure_name>' (
         <@param_name> <datatype>,
         …)
    searchable parameters (<@param_name>,..>)
    where:
    • replication_definition_name is the name of the function replication definition.

    • dataserver is the name of the server containing the primary data.

    • database is the name of the database containing the primary data.

    • procedure_name is the name of the stored procedure in the primary dataserver.

    • param_name is the parameter name from the function.

    For example:
    create function replication definition ins_authors with primary at primary_ase.pubs2(
         @au_id varchar(11),
         @au_lname varchar(40),
         @au_fname varchar(20),
         @phone char(12),
         @address varchar(40),
         @city varchar(20),
         @state char(2),
         @country varchar(12),
         @postalcode char(10))
    )
    searchable parameters(@au_id)

    For more information about create function replication definition, see the Replication Server Administration Guide and the Replication Server Reference Manual.