Creating the replication definition

A replication definition describes the data that can be replicated for a table or stored procedure defined in the primary database. RepConnector supports replication of DML commands and stored procedures. If you have already defined a replication definition, you can skip the following procedure.

If you have not already done so, you must mark primary tables or stored procedures for replication before continuing.

StepsCreating a table replication definition in Replication Server

  1. Gather the following information and record it on your worksheet where appropriate:

    • Primary data server name (in 3.k)

    • Primary database name (in 3.j)

    • Table names and column field name(s)

  2. Create the table replication definition:

    create replication definition
         <replication_definition_name>
    with primary at
         <dataserver>.<database>
    with all tables named '<table_name>'
    ( <column_name> <column_datatype>,
         …)
    primary key (<column name>,..))
    searchable columns (<column_name>,..)
    

    where:

    • replication_definition_name is the name for the replication definition.

    • dataserver is the name of the server containing the primary data (3.k).

    • database is the name of the database containing the primary data (3.j).

    • table_name is the name of the primary table containing the data.

    • column_name is the column name from the primary table.

    • column_datatype is the datatype for the column name.

    • primary key is a primary key, or a set of primary keys, defined in the table.

    For example:

    create replication definition authors_rep
    with primary at primary_ase.pubs2
    with all tables name 'authors' (
         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))
    primary key (au_id)
    searchable columns(au_id)
    

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

StepsCreating a function replication definition

To create a function replication definition in Replication Server:

  1. Gather the following information and record it on your worksheet, in Appendix A, “Configuration Worksheets,” where appropriate:

  2. Create the function replication definition:

    create function replication definition <relication_definition_name> 
    with primary at <dataserver>.<database>
    deliver as '<procedure_name>' (
         <@param_name> <datatype>,
         …)
    searchable parameters (<@param_name>,..>)
    

    where:

    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 the command create function replication definition, see the Replication Server Administration Guide and the Replication Server Reference Manual.