Chapter 5. A Tutorial for Adaptive Server Enterprise Users

You should create a directory for each of the two users of the replication system under your parent directory for this tutorial:

mkdir c:ntutorialnhq

mkdir c:ntutorialnfield

The next step is to add a pair of tables to the consolidated database.

To add tables to the consolidated database

1.Connect to the hq database from isql, as a system administrator.

2.Use the hq database:

use hq go

3. Create the SalesRep table with the following statement:

create table SalesRep ( rep_key char(12) not null, name char(40) not null, primary key (rep_key) )

go

4. Create the Customer table with the following statement:

create table Customer ( cust_key char(12) not null, name char(40) not null, rep_key char(12) not null, primary key (cust_key) )

go

5. Alter the Customer table to add a foreign key to the SalesRep table:

alter table Customer add foreign key

( rep_key ) references SalesRep go

You are now ready for the rest of the tutorial.

Setting up the consolidated database

This section of the tutorial describes how to prepare the consolidated database of a simple replication system.

Preparing a consolidated database for replication involves the following steps:

1. Create a message type to use for replication.

59

Page 77
Image 77
Sybase DC38133-01-0902-01 Setting up the consolidated database, Create the SalesRep table with the following statement