Lesson 8: Create the tables for the replicate database

The replicate site database needs to have tables to hold the data it receives. Now is a good time to create these tables. As long as the database elements are in place, no extra statements are necessary for them to act as a replicate site in a Replication Server installation. In particular, you do not need to set REPLICATE to ON, which is necessary only at the primary site.

Replication Server allows replication between tables and columns with different names. As a simple example, however, create a table in the replicate database identical in definition to that in the primary database (except for REPLICATE, which is not set to ON in the replicate database). The table creation statement for this is:

CREATE TABLE news (
   ID INT,
   AUTHOR CHAR( 40 ) DEFAULT CURRENT USER,
   TEXT CHAR( 255 ),
   PRIMARY KEY ( ID, AUTHOR )
)
go

For the tutorial, the CREATE TABLE statement must be exactly the same as that at the primary site.

You must ensure that the users dbmaint and sa can access this table without specifying the owner name. Also, these user IDs must have SELECT and UPDATE permissions on the table.